0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

added per-body timeScale

This commit is contained in:
liabru 2014-04-23 14:08:57 +01:00
parent 6e6dc49b7a
commit 613e63699b

View file

@ -42,6 +42,7 @@ var Body = {};
frictionAir: 0.01, frictionAir: 0.01,
groupId: 0, groupId: 0,
slop: 0.05, slop: 0.05,
timeScale: 1,
render: { render: {
visible: true, visible: true,
sprite: { sprite: {
@ -186,7 +187,7 @@ var Body = {};
* @param {number} correction * @param {number} correction
*/ */
Body.update = function(body, deltaTime, correction) { Body.update = function(body, deltaTime, correction) {
var deltaTimeSquared = deltaTime * deltaTime; var deltaTimeSquared = deltaTime * deltaTime * body.timeScale;
// from the previous step // from the previous step
var frictionAir = 1 - body.frictionAir, var frictionAir = 1 - body.frictionAir,