From 7e717b80598050cac794b863924c8e1501a30faa Mon Sep 17 00:00:00 2001 From: Brandon Grimshaw Date: Wed, 17 Oct 2018 13:22:11 +1000 Subject: [PATCH] Fix World.step reverting to fixed time step with 0 dt Calling World.step with a `timeSinceLastCalled` of 0 would cause it to revert to the fixed time step behaviour. This was due to the default value of `timeSinceLastCalled` being 0. This change checks for `undefined`, as opposed to 0. See issue #334 for more details. --- src/world/World.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/world/World.js b/src/world/World.js index 4260c1cb..5dad782a 100644 --- a/src/world/World.js +++ b/src/world/World.js @@ -501,9 +501,8 @@ var step_mg = vec2.create(), */ World.prototype.step = function(dt,timeSinceLastCalled,maxSubSteps){ maxSubSteps = maxSubSteps || 10; - timeSinceLastCalled = timeSinceLastCalled || 0; - if(timeSinceLastCalled === 0){ // Fixed, simple stepping + if(timeSinceLastCalled === undefined){ // Fixed, simple stepping this.internalStep(dt);