Skip to content

Commit

Permalink
cap the deltaTime in the demos
Browse files Browse the repository at this point in the history
  • Loading branch information
schteppe committed Oct 3, 2016
1 parent 98582f5 commit 87f81b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions demos/js/Renderer.js
Expand Up @@ -540,6 +540,11 @@ Renderer.prototype.startRenderingLoop = function(){
demo.resetCallTime = false;
}
lastCallTime = now;

// Cap if we have a really large deltatime.
// The requestAnimationFrame deltatime is usually below 0.0333s (30Hz) and on desktops it should be below 0.0166s.
timeSinceLastCall = Math.min(timeSinceLastCall, 0.5);

demo.world.step(demo.timeStep, timeSinceLastCall, demo.settings.maxSubSteps);
}
demo.render();
Expand Down

0 comments on commit 87f81b2

Please sign in to comment.