If _useDeltaForWorldStep
is set to false
, then a fixed timestep of 1/60
seconds is used for every Physics step.
If you’re running Physics on the main thread (like in this case) and switch tabs, I believe that the tab process freezes (to some extent?) for browser performance, which freezes rendering and Physics. So when you return to the Babylon JS window, the Physics has 2 options:
- Attempt to “catch up” to the current time by passing the large amount of time elapsed while you were on a different tab as
deltaTime
to the next Physics step calculation. You’ll see a transient speed-up in the Physics, e.g. an object falling 10X faster for a short period of time or an impulse - Forget about the time elapsed while you were on a different tab and just continue simulating Physics steps at a fixed timestep of
1/60
seconds
In summary:
_useDeltaForWorldStep: true
is more aligned with rendering frames. But, if rendering is disrupted by switching tabs, then Physics will face a disruption too_useDeltaForWorldStep: false
can yield a smoother Physics simulation with less speed-ups and unexpected impulses, but is less aligned with rendering
Here’s a great article on this: Fix Your Timestep! | Gaffer On Games