summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System
diff options
context:
space:
mode:
authorThePixelGamer <thepixelmaster2354@gmail.com>2024-07-26 18:00:57 -0500
committerThePixelGamer <thepixelmaster2354@gmail.com>2024-07-26 18:00:57 -0500
commitde0fd08acc676caad7dd2f445f221473d7cd4b75 (patch)
tree0808bc291b399ccbe9c8fe00b328f94a8da04aff /src/KingSystem/Physics/System
parent96f611fa5d1c2704d91e5c490662ec8c0a741279 (diff)
Update libraries and adjust code to match again
Diffstat (limited to 'src/KingSystem/Physics/System')
-rw-r--r--src/KingSystem/Physics/System/physContactMgr.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/KingSystem/Physics/System/physContactMgr.cpp b/src/KingSystem/Physics/System/physContactMgr.cpp
index ccc25385..7872f3ef 100644
--- a/src/KingSystem/Physics/System/physContactMgr.cpp
+++ b/src/KingSystem/Physics/System/physContactMgr.cpp
@@ -551,19 +551,20 @@ void ContactMgr::setImpulseEntryContactInfo(RigidBody* body_a, RigidBody* body_b
const auto relative_vel = linvel_a - linvel_b;
const auto dot_neg = [&](const auto& vec) { return vec.dot(-contact_point_normal); };
- float magnitude = is_flag_off ? sead::Mathf::max(0.0, relative_vel.dot(-contact_point_normal)) :
- sead::Mathf::max(0.0, relative_vel.length());
+ float magnitude = is_flag_off ?
+ sead::Mathf::clampMin(0.0, relative_vel.dot(-contact_point_normal)) :
+ sead::Mathf::clampMin(0.0, relative_vel.length());
if (magnitude >= entry->magnitude) {
float i1, i2;
if (is_flag_off) {
- i1 = sead::Mathf::min(sead::Mathf::max(0.0, dot_neg(linvel_a)), magnitude);
- i2 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_b.dot(contact_point_normal)),
- sead::Mathf::max(0.0, dot_neg(relative_vel)));
+ i1 = sead::Mathf::min(sead::Mathf::clampMin(0.0, dot_neg(linvel_a)), magnitude);
+ i2 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_b.dot(contact_point_normal)),
+ sead::Mathf::clampMin(0.0, dot_neg(relative_vel)));
} else {
- i1 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_a.length()), magnitude);
- i2 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_b.length()),
- sead::Mathf::max(0.0, relative_vel.length()));
+ i1 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_a.length()), magnitude);
+ i2 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_b.length()),
+ sead::Mathf::clampMin(0.0, relative_vel.length()));
}
entry->magnitude = magnitude;