Skip to content

Commit

Permalink
Fix World.step reverting to fixed time step with 0 dt
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Grimeh committed Oct 17, 2018
1 parent 2beb275 commit 7e717b8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/world/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7e717b8

Please sign in to comment.