mirror of https://github.com/AxioDL/metaforce.git
CGameCollision: Fix sign error
This commit is contained in:
parent
0d63119cfc
commit
7e97b6f997
|
@ -817,22 +817,25 @@ void CGameCollision::CollideWithDynamicBodyNoRot(CPhysicsActor& a0, CPhysicsActo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a0.GetVelocity().magnitude() > a0MaxCollisionVel)
|
if (a0.GetVelocity().magnitude() > a0MaxCollisionVel) {
|
||||||
a0.SetVelocityWR(a0.GetVelocity().normalized() * a0MaxCollisionVel);
|
a0.SetVelocityWR(a0.GetVelocity().normalized() * a0MaxCollisionVel);
|
||||||
if (a1.GetVelocity().magnitude() > a1MaxCollisionVel)
|
}
|
||||||
|
if (a1.GetVelocity().magnitude() > a1MaxCollisionVel) {
|
||||||
a1.SetVelocityWR(a1.GetVelocity().normalized() * a1MaxCollisionVel);
|
a1.SetVelocityWR(a1.GetVelocity().normalized() * a1MaxCollisionVel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1,
|
void CGameCollision::CollideWithStaticBodyNoRot(CPhysicsActor& a0, const CMaterialList& m0, const CMaterialList& m1,
|
||||||
const zeus::CUnitVector3f& normal, float restitution, bool zeroZ) {
|
const zeus::CUnitVector3f& normal, float restitution, bool zeroZ) {
|
||||||
zeus::CUnitVector3f useNorm = normal;
|
zeus::CUnitVector3f useNorm = normal;
|
||||||
if (zeroZ && m0.HasMaterial(EMaterialTypes::Player) && !m1.HasMaterial(EMaterialTypes::Floor))
|
if (zeroZ && m0.HasMaterial(EMaterialTypes::Player) && !m1.HasMaterial(EMaterialTypes::Floor)) {
|
||||||
useNorm.z() = 0.f;
|
useNorm.z() = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
if (useNorm.canBeNormalized()) {
|
if (useNorm.canBeNormalized()) {
|
||||||
useNorm.normalize();
|
useNorm.normalize();
|
||||||
float velNormDot = a0.GetVelocity().dot(useNorm);
|
float velNormDot = a0.GetVelocity().dot(useNorm);
|
||||||
if (velNormDot < 0.0001f) {
|
if (velNormDot < -0.0001f) {
|
||||||
a0.ApplyImpulseWR(useNorm * CollisionImpulseFiniteVsInfinite(a0.GetMass(), velNormDot, restitution),
|
a0.ApplyImpulseWR(useNorm * CollisionImpulseFiniteVsInfinite(a0.GetMass(), velNormDot, restitution),
|
||||||
zeus::CAxisAngle());
|
zeus::CAxisAngle());
|
||||||
a0.UseCollisionImpulses();
|
a0.UseCollisionImpulses();
|
||||||
|
|
Loading…
Reference in New Issue