163 relPos.
x = -relPos.
x;
185 scaledRelPos.
x = -scaledRelPos.
x;
228 fRot.
y = std::clamp(fRot.
y, -1.0f, 1.0f);
236 fLinear.
y += rotProj.
y;
237 fLinear.
y = std::min(fLinear.
y,
param()->stats().maxNormalAcceleration);
constexpr Vector3f ps_multVector(const Vector3f &vec) const
Paired-singles impl. of multVector.
constexpr void makeR(const Vector3f &r)
Sets 3x3 rotation matrix from a vector of Euler angles.
constexpr Vector3f multVector33(const Vector3f &vec) const
Multiplies a 3x3 matrix by a vector.
constexpr bool offBit(Es... es) const
Checks if all of the corresponding bits for the provided enum values are off.
constexpr bool onBit(Es... es) const
Checks if any of the corresponding bits for the provided enum values are on.
void createSingleHitbox(f32 radius, const EGG::Vector3f &relPos)
Creates a hitbox to represent a tire.
CollisionData & collisionData()
void setHitboxScale(f32 scale)
Hitbox & hitbox(u16 hitboxIdx)
void setWorldPos(const EGG::Vector3f &pos)
void setLastPos(const EGG::Vector3f &pos)
void trySetTargetSinkDepth(f32 val)
void calcWheelCollision(u16 wheelIdx, CollisionGroup *hitboxGroup, const EGG::Vector3f &colVel, const EGG::Vector3f ¢er, f32 radius)
Checks wheel hitbox collision and stores position/velocity info.
f32 floorMomentRate() const
const EGG::Vector3f & movement() const
void applySomeFloorMoment(f32 down, f32 rate, CollisionGroup *hitboxGroup, const EGG::Vector3f &forward, const EGG::Vector3f &nextDir, const EGG::Vector3f &speed, bool b1, bool b2, bool b3)
Applies external and angular velocity based on the collision with the floor.
const EGG::Vector3f & movingRoadVel() const
const EGG::Vector3f & movingObjVel() const
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.
const EGG::Quatf & fullRot() const
const EGG::Vector3f & intVel() const
virtual f32 leanRot() const
CollisionData & collisionData()
const EGG::Vector3f & extVel() const
EGG::Vector3f bodyForward() const
Returns the first column of the rotation matrix, which is the "right" direction.
KartDynamics * dynamics()
const EGG::Vector3f & pos() const
const EGG::Vector3f & scale() const
KartTire * tire(u16 tireIdx)
void updateSuspOvertravel(const EGG::Vector3f &suspOvertravel)
EGG::Vector3f m_topmostPos
EGG::Vector3f m_localBottomDir
m_bottomDir before applying the wheel matrix
KartSuspensionPhysics(u16 wheelIdx, TireType TireType, u16 bspWheelIdx)
TireType
Every other kart tire is a mirror of the first. Bikes do not leverage this.
void calcSuspension(const EGG::Vector3f &forward, const EGG::Vector3f &vehicleMovement)
Calculates linear force and rotation from the kart's suspension.
void calcCollision(const EGG::Vector3f &gravity, const EGG::Matrix34f &mat)
const BSP::Wheel * m_bspWheel
EGG::Vector3f m_bottomDir
WheelPhysics * m_tirePhysics
WheelPhysics * wheelPhysics()
EGG::Vector3f m_topmostPos
void setSuspTravel(f32 suspTravel)
void calcSuspension(const EGG::Vector3f &forward)
f32 m_targetEffectiveRadius
void setLastPosDiff(const EGG::Vector3f &pos)
EGG::Vector3f m_wheelEdgePos
f32 effectiveRadius() const
WheelPhysics(u16 wheelIdx, u16 bspWheelIdx)
const BSP::Wheel * m_bspWheel
const EGG::Vector3f & pos() const
void setLastPos(const EGG::Vector3f &pos)
CollisionGroup * hitboxGroup()
void setPos(const EGG::Vector3f &pos)
void updateCollision(const EGG::Vector3f &bottom, const EGG::Vector3f &topmostPos)
CollisionGroup * m_hitboxGroup
const EGG::Vector3f & topmostPos() const
void setWheelEdgePos(const EGG::Vector3f &pos)
void realign(const EGG::Vector3f &bottom, const EGG::Vector3f &vehicleMovement)
void setColVel(const EGG::Vector3f &vec)
EGG::Vector3f m_lastPosDiff
const EGG::Vector3f & lastPosDiff() const
void egg_delete(const T *ptr)
T * egg_new(Args &&...args)
Pertains to kart-related functionality.
@ SoftWallPush
Tracks whether we are being pushed by a soft wall or HWG.
@ SoftWallSuspension
Changes wheel physics after touching a soft wall.
@ JumpPadDisableYsusForce
@ LargeFlipHit
Set when hitting an exploding object.
constexpr Vector3f rotateVector(const Vector3f &vec) const
Rotates a vector based on the quat.
static const Vector3f zero
constexpr f32 dot(const Vector3f &rhs) const
The dot product between two vectors.
constexpr Vector3f proj(const Vector3f &rhs) const
The projection of this vector onto rhs.
EGG::Vector3f relPosition
std::array< Wheel, 4 > wheels
Information about the current collision and its properties.
bool bWall3
Set if colliding with COL_TYPE_WALL_2.
bool bWall
Set if colliding with KCL which satisfies KCL_TYPE_WALL.
s32 intensity
The KCL flag's "wheel depth".
bool bFloor
Set if colliding with KCL which satisfies KCL_TYPE_FLOOR.