55 if (scale.
y < totalScale) {
75 f32 yScaleFactor = scale.
y;
77 scaledPos.
x *= scale.
x;
78 scaledPos.
z *= scale.
z;
80 if (scale.
y != scale.
z && scale.
y < 1.0f) {
82 yScaleFactor = scale.
z;
85 scaledPos.
y *= yScaleFactor;
104 u16 bspHitboxCount = 0;
106 for (
const auto &
hitbox : hitboxes) {
107 if (parse<u16>(
hitbox.enable)) {
115 for (
const auto &bspHitbox : hitboxes) {
116 if (parse<u16>(bspHitbox.enable)) {
117 m_hitboxes[hitboxIdx++].setBspHitbox(&bspHitbox);
133 if (bspHitbox->
enable == 0) {
141 f32 maxComponent = max.
z;
143 if (max.
x <= max.
y) {
145 maxComponent = max.
y;
147 }
else if (max.
z < max.
x) {
148 maxComponent = max.
x;
169 bspHitbox->
radius = radius;
constexpr Vector3f ps_multVector(const Vector3f &vec) const
Paired-singles impl. of multVector.
void createSingleHitbox(f32 radius, const EGG::Vector3f &relPos)
Creates a hitbox to represent a tire.
void setHitboxScale(f32 scale)
Hitbox & hitbox(u16 hitboxIdx)
f32 computeCollisionLimits()
Sets the bounding radius.
owning_span< Hitbox > m_hitboxes
f32 initHitboxes(const std::array< BSP::Hitbox, 16 > &hitboxes)
Initializes the hitbox array based on the KartParam's BSP hitboxes.
CollisionData m_collisionData
void setRadius(f32 radius)
void calc(f32 totalScale, f32 sinkDepth, const EGG::Vector3f &scale, const EGG::Quatf &rot, const EGG::Vector3f &pos)
Calculates the position of a given hitbox, both relative to the player and world.
const BSP::Hitbox * m_bspHitbox
void setLastPos(const EGG::Vector3f &pos)
void setBspHitbox(const BSP::Hitbox *hitbox, bool owns=false)
const BSP::Hitbox * bspHitbox() const
owning_span()
Uninitialized buffer.
void egg_delete(const T *ptr)
T * egg_new(Args &&...args)
Pertains to kart-related functionality.
A quaternion, used to represent 3D rotation.
constexpr Vector3f rotateVector(const Vector3f &vec) const
Rotates a vector based on the quat.
constexpr Vector3f abs() const
Returns the absolute value of each element of the vector.
static const Vector3f zero
constexpr Vector3f maximize(const Vector3f &rhs) const
Returns a vector whose elements are the max of the elements of both vectors.
Represents one of the many hitboxes that make up a vehicle.
EGG::Vector3f position
The relative position of the hitbox.
u16 enable
Specifies if this is an active hitbox (since BSP always has 16).
bool bMovingWaterDecaySpeed
Player speed will drop if not in mushroom.
u32 closestFloorSettings
The colliding floor KCL flag's "variant".
Field::KCLTypeMask closestFloorFlags
The colliding floor KCL flag's KColType.
EGG::Vector3f roadVelocity
bool bMovingWaterDisableAccel
KC last turn prevents mini-turbo acceleration.
bool bWall3
Set if colliding with COL_TYPE_WALL_2.
bool bMovingWaterStickyRoad
KC pipe vertical water section.
bool bWall
Set if colliding with KCL which satisfies KCL_TYPE_WALL.
s32 intensity
The KCL flag's "wheel depth".
bool bMovingWaterMomentum
Player will maintain speed for a bit after leaving KCL.
Field::KCLTypeMask closestWallFlags
The colliding wall KCL flag's KColType.
bool bFloor
Set if colliding with KCL which satisfies KCL_TYPE_FLOOR.
bool bMovingWaterVertical
KC last turn vertical water.