diff --git a/src/core/Engine.js b/src/core/Engine.js index 91b55ac..bc5ce0a 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -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;