Skip to content

Commit 7e717b8

Browse files
committed
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 schteppe#334 for more details.
1 parent 2beb275 commit 7e717b8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/world/World.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,8 @@ var step_mg = vec2.create(),
501501
*/
502502
World.prototype.step = function(dt,timeSinceLastCalled,maxSubSteps){
503503
maxSubSteps = maxSubSteps || 10;
504-
timeSinceLastCalled = timeSinceLastCalled || 0;
505504

506-
if(timeSinceLastCalled === 0){ // Fixed, simple stepping
505+
if(timeSinceLastCalled === undefined){ // Fixed, simple stepping
507506

508507
this.internalStep(dt);
509508

0 commit comments

Comments
 (0)