@@ -47,8 +47,8 @@ Rigid::Rigid()
4747 friction = 0 .5f ;
4848 atRest = false ;
4949
50- sleepLinearThreshold = 0 . 0004f ;
51- sleepAngThreshold = 0 . 0004f ;
50+ sleepLinearThreshold = POINT_EPSILON ;
51+ sleepAngThreshold = POINT_EPSILON ;
5252 sleepTimeThreshold = 0 .75f ;
5353 sleepTimer = 0 .0f ;
5454}
@@ -71,7 +71,7 @@ void Rigid::integrate(F32 delta)
7171 linVelocity = linMomentum * oneOverMass;
7272
7373 // 2. advance orientation if ang vel significant
74- F32 angle = angVelocity.len ();
74+ F32 angle = angVelocity.len ()*delta ;
7575 if (mFabs (angle)> POINT_EPSILON)
7676 {
7777 QuatF dq;
@@ -101,7 +101,7 @@ void Rigid::integrate(F32 delta)
101101 }
102102
103103 // 5. refresh ang velocity
104- updateAngularVelocity ();
104+ updateAngularVelocity (delta );
105105
106106
107107 // 6. CoM update
@@ -138,7 +138,7 @@ void Rigid::updateCenterOfMass()
138138
139139void Rigid::applyImpulse (const Point3F &r, const Point3F &impulse)
140140{
141- if (impulse.lenSquared () < mass) return ;
141+ if (( impulse.lenSquared () - mass) < POINT_EPSILON ) return ;
142142 wake ();
143143
144144 // Linear momentum and velocity
@@ -304,7 +304,8 @@ void Rigid::trySleep(F32 dt)
304304 // If there is active force/torque, don’t sleep
305305 if (!force.isZero () || !torque.isZero ())
306306 {
307- sleepTimer = 0 .0f ; return ;
307+ sleepTimer = 0 .0f ;
308+ return ;
308309 }
309310
310311 const F32 linV2 = linVelocity.lenSquared ();
0 commit comments