22 if (EGG::Mathf::abs(top.
dot(
m_top)) >= 0.9999f) {
64 constexpr f32 TWELFTH = 1.0f / 12.0f;
91 constexpr f32 TERMINAL_Y_VEL = 120.0f;
109 playerBackHoriz.
y = 0.0f;
111 if (playerBackHoriz.
squaredLength() > std::numeric_limits<f32>::epsilon()) {
118 norm = norm > std::numeric_limits<f32>::epsilon() ? EGG::Mathf::sqrt(norm) : 0.0f;
121 if (speedBack.
dot(playerBackHoriz) < 0.0f) {
153 if (angVelSum.
squaredLength() > std::numeric_limits<f32>::epsilon()) {
256 if (EGG::Mathf::abs(top.
dot(local_4c)) >= 0.9999f) {
constexpr void makeQ(const Quatf &q)
Sets rotation matrix from quaternion.
constexpr Matrix34f transpose() const
Transposes the 3x3 portion of the matrix.
constexpr void inverseTo33(Matrix34f &out) const
Inverts the 3x3 portion of the 3x4 matrix.
static const Matrix34f zero
constexpr Vector3f multVector33(const Vector3f &vec) const
Multiplies a 3x3 matrix by a vector.
constexpr Matrix34f multiplyTo(const Matrix34f &rhs) const
Multiplies two matrices.
static const Matrix34f ident
void forceUpright() override
void stabilize() override
Stabilizes the bike by rotating towards the y-axis unit vector.
bool m_noGravity
Disables gravity. Relevant when respawning.
EGG::Quatf m_fullRot
The combination of the other rotations.
bool m_forceUpright
Specifies if we should return the vehicle to upwards orientation.
EGG::Matrix34f calcWorldInertiaTensor() const
EGG::Vector3f m_acceleration
Basically just m_totalForce.
EGG::Vector3f m_movingObjVel
Velocity from things like TF conveyors.
EGG::Vector3f m_totalTorque
Torque from linear motion and rotation.
EGG::Vector3f m_movingRoadVel
Velocity from Koopa Cape water.
EGG::Matrix34f m_invInertiaTensor
The inverse of m_inertiaTensor.
EGG::Vector3f m_top
The unit vector pointing up from the vehicle.
EGG::Vector3f m_angVel0
Angular velocity from m_totalTorque.
void applySuspensionWrench(const EGG::Vector3f &p, const EGG::Vector3f &Flinear, const EGG::Vector3f &Frot, bool ignoreX)
Every frame, computes torque from linear motion and rotation.
EGG::Vector3f m_extVel
Velocity induced by collisions.
EGG::Vector3f m_angVel2
The main component of angular velocity.
EGG::Vector3f m_top_
Basically m_top biased towards absolute up.
EGG::Vector3f m_pos
The vehicle's position.
virtual void stabilize()
Stabilizes the kart by rotating towards the y-axis unit vector.
void calc(f32 maxSpeed, bool air)
Every frame, computes acceleration, velocity, position and rotation of the kart.
void setInertia(const EGG::Vector3f &m, const EGG::Vector3f &n)
virtual void forceUpright()
EGG::Matrix34f m_inertiaTensor
Resistance to rotational change, as a 3x3 matrix.
EGG::Quatf m_extraRot
[Unused]
EGG::Vector3f m_intVel
What you typically consider to be the vehicle's speed.
EGG::Vector3f m_velocity
Sum of the linear velocities.
EGG::Vector3f m_totalForce
Basically just gravity.
EGG::Quatf m_specialRot
Rotation from trick animations. Copied from KartPhysics.
f32 m_speedNorm
Min of the max speed and m_velocity magnitude.
void applyWrenchScaled(const EGG::Vector3f &p, const EGG::Vector3f &f, f32 scale)
Applies a force linearly and rotationally to the kart.
f32 m_angVel0Factor
Scalar for damping angular velocity.
void setBspParams(f32 rotSpeed, const EGG::Vector3f &m, const EGG::Vector3f &n, bool skipInertia)
On init, takes elements from the kart's BSP and computes the moment of inertia tensor.
f32 m_gravity
Usually -1.3f, also affected by KartMove::calcDive.
f32 m_stabilizationFactor
Scalar for damping the main rotation.
EGG::Quatf m_mainRot
Rotation based on the angular velocities.
f32 m_angVel0YFactor
Scalar for damping angular velocity.
bool m_killExtVelY
Caps external velocity at 0.
EGG::Vector3f m_angVel1
[Unused]
Pertains to kart-related functionality.
A quaternion, used to represent 3D rotation.
constexpr void makeVectorRotation(const Vector3f &from, const Vector3f &to)
Captures rotation between two vectors.
constexpr void normalise()
Scales the quaternion to a unit length.
constexpr Vector3f rotateVector(const Vector3f &vec) const
Rotates a vector based on the quat.
constexpr f32 squaredNorm() const
Computes .
constexpr Quatf multSwap(const Vector3f &vec) const
constexpr Quatf slerpTo(const Quatf &q1, f32 t) const
Performs spherical linear interpolation.
constexpr Vector3f rotateVectorInv(const Vector3f &vec) const
Rotates a vector on the inverse quat.
constexpr f32 squaredLength() const
The dot product between the vector and itself.
static const Vector3f zero
constexpr f32 dot(const Vector3f &rhs) const
The dot product between two vectors.
constexpr f32 normalise()
Normalizes the vector and returns the original length.
constexpr Vector3f cross(const Vector3f &rhs) const
static const Vector3f unit
constexpr std::pair< Vector3f, Vector3f > projAndRej(const Vector3f &rhs) const