0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-29 14:19:01 -05:00

added high delta warning to Matter.Engine

This commit is contained in:
liabru 2023-08-14 23:53:22 +01:00
parent 7ec38a1f1c
commit 72e6e899a6

View file

@ -24,6 +24,8 @@ var Body = require('../body/Body');
(function() {
Engine._deltaMax = 1000 / 60;
/**
* Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults.
* All properties have default values, and many are pre-calculated automatically based on other properties.
@ -88,6 +90,13 @@ var Body = require('../body/Body');
timestamp = timing.timestamp,
i;
// warn if high delta
if (delta > Engine._deltaMax) {
Common.warnOnce(
'Matter.Engine.update: delta argument is recommended to be less than or equal to', Engine._deltaMax.toFixed(3), 'ms.'
);
}
delta = typeof delta !== 'undefined' ? delta : Common._baseDelta;
delta *= timing.timeScale;