1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Rework PhysX collision flutter bug workaround

To better handle erroneous trigger events under the new timing method, use the number of times the simulation has actually advanced instead of the number of evals received.

Cleaned up a bit.
This commit is contained in:
Skoader
2012-12-02 01:02:49 -05:00
committed by Adam Johnson
parent d06ba6362c
commit d3ea8fe333
4 changed files with 166 additions and 114 deletions

View File

@ -283,6 +283,7 @@ plSimulationMgr* plSimulationMgr::GetInstance()
plSimulationMgr::plSimulationMgr()
: fSuspended(true)
, fAccumulator(0.0f)
, fStepCount(0)
, fLOSDispatch(new plLOSDispatch())
, fSoundMgr(new plPhysicsSoundMgr)
, fLog(nil)
@ -468,6 +469,8 @@ void plSimulationMgr::Advance(float delSecs)
fAccumulator = kDefaultMaxDelta;
}
++fStepCount;
// Perform as many whole substeps as possible saving the remainder in our accumulator.
int numSubSteps = (int)(fAccumulator / kDefaultStepSize + 0.000001f);
float delta = numSubSteps * kDefaultStepSize;

View File

@ -99,6 +99,8 @@ public:
int GetMaterialIdx(NxScene* scene, float friction, float restitution);
uint32_t GetStepCount() const { return fStepCount; }
//Fix to Move collision messages and their handling out of the simulation step
void AddCollisionMsg(plKey hitee, plKey hitter, bool entering);
void AddCollisionMsg(plCollideMsg* msg);
@ -139,6 +141,7 @@ protected:
bool fSuspended;
float fAccumulator;
uint32_t fStepCount;
// A utility class to keep track of a request for a physical synchronization.
// These requests must pass a certain criteria (see the code for the latest)