A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
JugemMove.hh
1#pragma once
2
3#include "game/kart/KartObject.hh"
4
5namespace Kinoko::Field {
6
8class JugemMove {
9public:
10 JugemMove(const Kart::KartObject *kartObj);
11 ~JugemMove();
12
13 void init();
14 void calc();
15
17 void setPos(const EGG::Vector3f &pos, bool transPos) {
18 m_pos = pos;
19
20 if (transPos) {
21 m_transPos = pos;
22 }
23 }
24
25 void setForwardFromKartObjPosDelta(bool set124);
26 void setForwardFromKartObjMainRot(bool set124);
27
29 void setAnchorPos(const EGG::Vector3f &v) {
30 m_anchorPos = v;
31 }
32
33 void setRiseVel(const EGG::Vector3f &v) {
34 m_riseVel = v;
35 }
36
37 void setAwayOrDescending(bool isSet) {
38 m_isAwayOrDescending = isSet;
39 }
40
41 void setDescending(bool isSet) {
42 m_isDescending = isSet;
43 }
44
45 void setRising(bool isSet) {
46 m_isRising = isSet;
47 }
48
49 const EGG::Vector3f &transPos() const {
50 return m_transPos;
51 }
52
53 const EGG::Matrix34f &transform() const {
54 return m_transform;
55 }
56
57private:
58 EGG::Matrix34f calcOrthonormalBasis();
59 EGG::Vector3f calcOscillation(const EGG::Matrix34f &mat);
60 [[nodiscard]] EGG::Matrix34f FUN_807202BC();
61
62 [[nodiscard]] static EGG::Vector3f Interpolate(f32 t, const EGG::Vector3f &v0,
63 const EGG::Vector3f &v1) {
64 return v0 + (v1 - v0) * t;
65 }
66
67 const Kart::KartObject *m_kartObj;
68 EGG::Vector3f m_pos;
69 EGG::Vector3f m_transPos;
70 EGG::Vector3f m_anchorPos;
71 EGG::Matrix34f m_28;
72 EGG::Matrix34f m_58;
73 EGG::Matrix34f m_88;
74 EGG::Matrix34f m_transform;
77 EGG::Vector3f m_lastKartObjPos;
78 EGG::Vector3f m_velDir;
80 EGG::Vector3f m_dir;
83 f32 m_forwardInterpRate;
84 bool m_isAwayOrDescending;
85 f32 m_velDirInterpRate;
86 bool m_isDescending;
87 bool m_isRising;
88};
89
90} // namespace Kinoko::Field
A 3 x 4 matrix.
Definition Matrix.hh:10
Manages state information related to Lakitu movement.
Definition JugemMove.hh:8
f32 m_phaseY
Up/down oscillation phase.
Definition JugemMove.hh:76
EGG::Vector3f m_riseVel
Velocity of Lakitu once he leaves by rising upwards.
Definition JugemMove.hh:79
f32 m_phaseX
Left/right oscillation phase.
Definition JugemMove.hh:75
EGG::Vector3f m_targetForward
The direction that Lakitu wants to move to.
Definition JugemMove.hh:82
EGG::Vector3f m_currForward
The current direction that Lakitu is at.
Definition JugemMove.hh:81
The highest level abstraction for a kart.
Definition KartObject.hh:11
Pertains to collision.
A 3D float vector.
Definition Vector.hh:107