skip out on impulses that have no chance of moving the object

also, sRestTol already is a 0.5 multiplier
This commit is contained in:
AzaezelX 2025-03-09 18:40:49 -05:00
parent ab73099dd9
commit 325b3a97c0
3 changed files with 3 additions and 2 deletions

View file

@ -117,6 +117,7 @@ void Rigid::updateCenterOfMass()
void Rigid::applyImpulse(const Point3F &r, const Point3F &impulse)
{
if (impulse.lenSquared() < mass) return;
atRest = false;
// Linear momentum and velocity

View file

@ -1118,7 +1118,7 @@ void RigidShape::updatePos(F32 dt)
{
F32 k = mRigid.getKineticEnergy();
F32 G = mNetGravity* dt * TickMs / mDataBlock->integration;
F32 Kg = 0.5 * mRigid.mass * G * G;
F32 Kg = mRigid.mass * G * G;
if (k < sRestTol * Kg && ++restCount > sRestCount)
mRigid.setAtRest();
}

View file

@ -808,7 +808,7 @@ void Vehicle::updatePos(F32 dt)
{
F32 k = mRigid.getKineticEnergy();
F32 G = mNetGravity* dt * TickMs / mDataBlock->integration;
F32 Kg = 0.5 * mRigid.mass * G * G;
F32 Kg = mRigid.mass * G * G;
if (k < sRestTol * Kg && ++restCount > sRestCount)
mRigid.setAtRest();
}