From b8a15635a921abdc88cbe27b5bb20ae0d872abd9 Mon Sep 17 00:00:00 2001 From: liabru Date: Wed, 1 May 2024 21:21:25 +0100 Subject: [PATCH] improve Matter.Runner --- src/core/Runner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Runner.js b/src/core/Runner.js index a466b35..2819e89 100644 --- a/src/core/Runner.js +++ b/src/core/Runner.js @@ -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; }