from marauder: sleep threshold work

This commit is contained in:
AzaezelX 2025-08-19 08:49:05 -05:00
parent d5a111e9ff
commit a0bd5dd426
2 changed files with 88 additions and 14 deletions

View file

@ -61,11 +61,18 @@ public:
F32 oneOverMass; ///< 1 / mass
F32 restitution; ///< Collision restitution
F32 friction; ///< Friction coefficient
// sleep threshold parameters
F32 sleepLinearThreshold; ///< M/S ^ 2
F32 sleepAngThreshold; ///< R/S ^ 2
F32 sleepTimeThreshold; ///< Seconds
F32 sleepTimer;
bool atRest;
private:
void translateCenterOfMass(const Point3F &oldPos,const Point3F &newPos);
void trySleep(F32 dt);
public:
//
Rigid();
@ -94,6 +101,11 @@ public:
bool checkRestCondition();
void setAtRest();
//
void setSleepThresholds(F32 linVel2, F32 angVel2, F32 timeToSleep);
void wake();
TORQUE_FORCEINLINE void updateAngularVelocity() { invWorldInertia.mulV(angMomentum, &angVelocity); }
};