# Havok strange behaviour when switching tabs on last versions

**URL:** <https://forum.babylonjs.com/t/havok-strange-behaviour-when-switching-tabs-on-last-versions/51618>\
**Category:** Bugs\
**Created:** [June 26, 2024, 2:31pm UTC](https://forum.babylonjs.com/t/havok-strange-behaviour-when-switching-tabs-on-last-versions/51618 "2024-06-26T14:31:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![regna](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/regna/32/23915_2.png) [@regna](https://forum.babylonjs.com/u/regna)\
**Post date:** [June 26, 2024, 4:26pm UTC](https://forum.babylonjs.com/t/havok-strange-behaviour-when-switching-tabs-on-last-versions/51618/4 "2024-06-26T16:26:17Z")

</div>

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](https://gafferongames.com/post/fix_your_timestep/)

---

_[View the full topic](https://forum.babylonjs.com/t/havok-strange-behaviour-when-switching-tabs-on-last-versions/51618)._
