A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KartSub.hh
1#pragma once
2
3#include "game/kart/KartMove.hh"
4
5namespace Kart {
6
7class KartObject;
8
12public:
13 KartSub();
14 ~KartSub();
15
16 void createSubsystems(bool isBike);
17 void copyPointers(KartAccessor &pointers);
18
19 void init();
20 void initAABB(KartAccessor &accessor, KartObject *object);
21 void initPhysicsValues();
22 void resetPhysics();
23
24 void calcPass0();
25 void calcPass1();
26 void resizeAABB(f32 radiusScale);
27 void addFloor(const CollisionData &, bool);
28 void updateSuspOvertravel(const EGG::Vector3f &suspOvertravel);
29 void tryEndHWG();
30 void calcMovingObj();
31
33 [[nodiscard]] f32 someScale() {
34 return m_someScale;
35 }
37
38private:
39 KartMove *m_move;
40 KartAction *m_action;
41 KartCollide *m_collide;
42 KartState *m_state;
43 EGG::Vector3f m_maxSuspOvertravel;
44 EGG::Vector3f m_minSuspOvertravel;
45 u16 m_floorCollisionCount;
46 u16 m_movingObjCollisionCount;
47 EGG::Vector3f m_objVel;
50 f32 m_someScale;
51
52 static constexpr f32 DT = 1.0f;
53};
54
55} // namespace Kart
Manages body+wheel collision and its influence on position/velocity/etc.
Responsible for reacting to player inputs and moving the kart.
Definition KartMove.hh:18
Base class for most kart-related objects.
The highest level abstraction for a kart.
Definition KartObject.hh:11
Houses various flags and other variables to preserve the kart's state.
Definition KartState.hh:12
Hosts a few classes and the high level per-frame calc functions.
Definition KartSub.hh:11
void calcPass0()
The first phase of physics computations on each frame.
Definition KartSub.cc:100
static constexpr f32 DT
Delta time.
Definition KartSub.hh:52
void copyPointers(KartAccessor &pointers)
Called during static construction of KartObject to synchronize the pointers.
Definition KartSub.cc:41
f32 m_colPerpendicularity
Dot product between floor and colliding wall normals.
Definition KartSub.hh:49
void calcPass1()
The second phase of physics computations on each frame.Handles the second-half of physics calculation...
Definition KartSub.cc:171
s16 m_sideCollisionTimer
Number of frames to apply movement from wall collision.
Definition KartSub.hh:48
Pertains to kart-related functionality.
A 3D float vector.
Definition Vector.hh:83
Information about the current collision and its properties.
Shared between classes who inherit KartObjectProxy so they can access one another.