Skip to content
Browse files

more deterministic physics

  • Loading branch information...
1 parent ff08a72 commit f1f61599746a2d13793dfc153bee2aa1a8da2022 @toolness toolness committed
Showing with 2 additions and 3 deletions.
  1. +2 −3 js/physics.js
View
5 js/physics.js
@@ -172,11 +172,10 @@ function startPhysics(worldParent) {
var velocityIterations = 6;
var positionIterations = 2;
- var startTime = Date.now();
+ var intervalTime = 1.0 / 60.0;
var interval = setInterval(function() {
- var realTimePassed = Date.now() - startTime;
- world.Step(realTimePassed / 100000.0, velocityIterations,
+ world.Step(intervalTime, velocityIterations,
positionIterations);
objects.forEach(function(o) { o.updateElement(); });
}, 20);

0 comments on commit f1f6159

Please sign in to comment.
Something went wrong with that request. Please try again.