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

improve Matter.Runner

This commit is contained in:
liabru 2024-05-01 21:21:25 +01:00
parent 804634144f
commit b8a15635a9

View file

@ -22,7 +22,7 @@ var Common = require('./Common');
(function() {
Runner._maxFrameDelta = 1000 / 5;
Runner._maxFrameDelta = 1000 / 15;
Runner._frameDeltaFallback = 1000 / 60;
Runner._timeBufferMargin = 1.5;
Runner._elapsedNextEstimate = 1;
@ -105,7 +105,7 @@ var Common = require('./Common');
var frameDelta = time - runner.timeLastTick;
// fallback for unusable frame delta values (e.g. 0, NaN, on first frame or long pauses)
if (!frameDelta || !runner.timeLastTick || frameDelta > Runner._maxFrameDelta) {
if (!frameDelta || !runner.timeLastTick || frameDelta > Math.max(Runner._maxFrameDelta, runner.maxFrameTime)) {
// reuse last accepted frame delta else fallback
frameDelta = runner.frameDelta || Runner._frameDeltaFallback;
}