0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-13 00:28:28 -04:00

Issue #855: Using seconds to calculate velocity from force

This commit is contained in:
Ewall198 2020-04-18 16:32:56 -04:00
parent 5a0079df1b
commit 8a4480eb0a

View file

@ -628,7 +628,8 @@ var Axes = require('../geometry/Axes');
* @param {number} correction
*/
Body.update = function(body, deltaTime, timeScale, correction) {
var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2);
// Delta time squared in seconds
var deltaTimeSquared = Math.pow(deltaTime / 1000 * timeScale * body.timeScale, 2);
// from the previous step
var frictionAir = 1 - body.frictionAir * timeScale * body.timeScale,