A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectCollidable.hh
1#pragma once
2
3#include "game/field/obj/ObjectBase.hh"
4
5#include "game/field/ObjectCollisionBase.hh"
6
7namespace Kart {
8
9class KartObject;
10enum class Reaction;
11
12} // namespace Kart
13
14namespace Field {
15
17public:
19 ~ObjectCollidable() override;
20
21 void load() override;
22 void calcCollisionTransform() override;
23 [[nodiscard]] f32 getCollisionRadius() const override;
24
25 virtual void loadAABB(f32 maxSpeed);
26 virtual void loadAABB(f32 radius, f32 maxSpeed);
27 virtual void processKartReactions(Kart::KartObject *kartObj, Kart::Reaction &reactionOnKart,
28 Kart::Reaction &reactionOnObj);
29
31 virtual Kart::Reaction onCollision(Kart::KartObject * /*kartObj*/,
32 Kart::Reaction reactionOnKart, Kart::Reaction /*reactionOnObj*/,
33 EGG::Vector3f & /*hitDepth*/) {
34 return reactionOnKart;
35 }
36
37 virtual void onWallCollision(Kart::KartObject *, const EGG::Vector3f &) {}
38 virtual void onObjectCollision(Kart::KartObject *) {}
39
41 virtual bool checkCollision(ObjectCollisionBase *lhs, EGG::Vector3f &dist);
42
44 virtual const EGG::Vector3f &getCollisionTranslation() const {
45 return EGG::Vector3f::zero;
46 }
47
49 [[nodiscard]] virtual ObjectCollisionBase *collision() const {
50 return m_collision;
51 }
52
53protected:
54 void createCollision() override;
55
57 virtual const EGG::Vector3f &collisionCenter() const {
58 return EGG::Vector3f::zero;
59 }
60
61 ObjectCollisionBase *m_collision;
62};
63
64} // namespace Field
f32 getCollisionRadius() const override
Finds the radius that fits fully in a BoxColUnit.
The base class that all objects' collision inherits from.
The highest level abstraction for a kart.
Definition KartObject.hh:11
Pertains to collision.
Pertains to kart-related functionality.
A 3D float vector.
Definition Vector.hh:83