From 025fb1fb02edb2f9477d3c1b0118323cee569e19 Mon Sep 17 00:00:00 2001 From: Skoader Date: Sat, 13 Oct 2012 21:21:33 +1100 Subject: [PATCH] Improve simulation timing at low frame rates. Increased kDefaultMaxDelta to 0.15. Added a small bias to combat a truncation issue. --- .../Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp index d35a0959..ddace665 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp @@ -261,7 +261,7 @@ public: // ///////////////////////////////////////////////////////////////// -#define kDefaultMaxDelta 0.1 // if the step is greater than .1 seconds, clamp to that +#define kDefaultMaxDelta 0.15 // if the step is greater than .15 seconds, clamp to that #define kDefaultStepSize 1.f / 60.f // default simulation freqency is 60hz ///////////////////////////////////////////////////////////////// @@ -610,7 +610,7 @@ void plSimulationMgr::Advance(float delSecs) } // Perform as many whole substeps as possible saving the remainder in our accumulator. - int numSubSteps = (int)(fAccumulator / fStepSize); + int numSubSteps = (int)(fAccumulator / fStepSize + 0.000001f); float delta = numSubSteps * fStepSize; fAccumulator -= delta;