mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-28 14:09:01 -05:00
added high delta warning to Matter.Engine
This commit is contained in:
parent
7ec38a1f1c
commit
72e6e899a6
1 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue