Skip to content

Commit

Permalink
added default for delta parameter in Engine.update, closes #200
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Feb 7, 2016
1 parent cc80837 commit 490d232
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ var Body = require('../body/Body');
* Triggers `collisionStart`, `collisionActive` and `collisionEnd` events.
* @method update
* @param {engine} engine
* @param {number} delta
* @param {number} [correction]
* @param {number} [delta=16.666]
* @param {number} [correction=1]
*/
Engine.update = function(engine, delta, correction) {
correction = (typeof correction !== 'undefined') ? correction : 1;
delta = delta || 1000 / 60;
correction = correction || 1;

var world = engine.world,
timing = engine.timing,
Expand Down

2 comments on commit 490d232

@Inve1951
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brakes engine.timing.timeScale = 0 for freezing.
Causes stuff to float around like there wouldn't be any gravity.
I however couldn't reproduce that behavior on the demo page.

Should be something like:

delta = delta != null ? delta : 1000 / 60;
correction = correction != null ? correction : 1;

or

delta = typeof delta !== 'undefined' ? delta : 1000 / 60;
correction = typeof correction !== 'undefined' ? correction : 1;

@liabru
Copy link
Owner Author

@liabru liabru commented on 490d232 Oct 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is a bug, can you please add an issue for this? Thanks

Please sign in to comment.