summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp')
-rw-r--r--src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp b/src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp
index 1226372b..1ded03e0 100644
--- a/src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp
+++ b/src/KingSystem/Physics/RigidBody/Shape/Box/physBoxShape.cpp
@@ -11,9 +11,9 @@ BoxShape* BoxShape::make(const BoxShapeParam& param, sead::Heap* heap) {
hkpBoxShape* box = nullptr;
if (auto* storage = util::allocStorage<hkpBoxShape>(heap)) {
const auto radius = param.convex_radius;
- const hkVector4f half_extents{sead::Mathf::max(param.extents.x / 2 - radius, 0.001),
- sead::Mathf::max(param.extents.y / 2 - radius, 0.001),
- sead::Mathf::max(param.extents.z / 2 - radius, 0.001)};
+ const hkVector4f half_extents{sead::Mathf::clampMin(param.extents.x / 2 - radius, 0.001),
+ sead::Mathf::clampMin(param.extents.y / 2 - radius, 0.001),
+ sead::Mathf::clampMin(param.extents.z / 2 - radius, 0.001)};
box = new (storage) hkpBoxShape(half_extents, radius);
}
@@ -122,9 +122,10 @@ const hkpShape* BoxShape::updateHavokShape() {
if (mFlags.isOn(Flag::Dirty)) {
{
const auto radius = mHavokShape->getRadius();
- const sead::Vector3f half_extents{sead::Mathf::max(mExtents.x / 2 - radius, 0.001),
- sead::Mathf::max(mExtents.y / 2 - radius, 0.001),
- sead::Mathf::max(mExtents.z / 2 - radius, 0.001)};
+ const sead::Vector3f half_extents{
+ sead::Mathf::clampMin(mExtents.x / 2 - radius, 0.001),
+ sead::Mathf::clampMin(mExtents.y / 2 - radius, 0.001),
+ sead::Mathf::clampMin(mExtents.z / 2 - radius, 0.001)};
const auto ref_count = mHavokShape->getReferenceCount();
mHavokShape = new (mHavokShape) hkpBoxShape(toHkVec4(half_extents), radius);
mHavokShape->setReferenceCount(ref_count);