0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-25 13:39:06 -05:00

rename internal Common._timeUnit to Common._baseDelta

This commit is contained in:
liabru 2022-09-02 17:59:15 +01:00
parent 36575b3438
commit dc46472720
6 changed files with 7 additions and 7 deletions

View file

@ -759,7 +759,7 @@ var Axes = require('../geometry/Axes');
correction = Body._timeCorrection ? deltaTime / (body.deltaTime || deltaTime) : 1;
// from the previous step
var frictionAir = 1 - body.frictionAir * (deltaTime / Common._timeUnit),
var frictionAir = 1 - body.frictionAir * (deltaTime / Common._baseDelta),
velocityPrevX = (body.position.x - body.positionPrev.x) * correction,
velocityPrevY = (body.position.y - body.positionPrev.y) * correction;

View file

@ -62,7 +62,7 @@ var Bounds = require('../geometry/Bounds');
contactShare,
positionImpulse,
positionDampen = Resolver._positionDampen * (damping || 1),
slopDampen = Common.clamp(delta / Common._timeUnit, 0, 1),
slopDampen = Common.clamp(delta / Common._baseDelta, 0, 1),
pairsLength = pairs.length;
// find impulses required to resolve penetration
@ -226,7 +226,7 @@ var Bounds = require('../geometry/Bounds');
* @param {number} delta
*/
Resolver.solveVelocity = function(pairs, delta) {
var timeScale = delta / Common._timeUnit,
var timeScale = delta / Common._baseDelta,
timeScaleSquared = timeScale * timeScale,
timeScaleCubed = timeScaleSquared * timeScale,
restingThresh = -Resolver._restingThresh * timeScale,

View file

@ -113,7 +113,7 @@ var Common = require('../core/Common');
* @param {number} delta
*/
Constraint.solveAll = function(constraints, delta) {
var timeScale = Common.clamp(delta / Common._timeUnit, 0, 1);
var timeScale = Common.clamp(delta / Common._baseDelta, 0, 1);
// Solve fixed constraints first.
for (var i = 0; i < constraints.length; i += 1) {

View file

@ -10,7 +10,7 @@ module.exports = Common;
(function() {
Common._timeUnit = 1000 / 60;
Common._baseDelta = 1000 / 60;
Common._nextId = 0;
Common._seed = 0;
Common._nowStartTime = +(new Date());

View file

@ -88,7 +88,7 @@ var Body = require('../body/Body');
timestamp = timing.timestamp,
i;
delta = typeof delta !== 'undefined' ? delta : Common._timeUnit;
delta = typeof delta !== 'undefined' ? delta : Common._baseDelta;
delta *= timing.timeScale;
// increment timestamp

View file

@ -25,7 +25,7 @@ var Common = require('./Common');
* @param {number} delta
*/
Sleeping.update = function(bodies, delta) {
var timeScale = delta / Common._timeUnit,
var timeScale = delta / Common._baseDelta,
motionSleepThreshold = Sleeping._motionSleepThreshold;
// update bodies sleeping status