#303·matter-js

Changing Time Scale Affects Physics

Author: Inve1951Created Oct 12, 2016Updated Dec 5, 2025
Labelsinvestigate

Changing engine.timing.timeScale significantly affects physics. (even for resting bodies) It's well observable on the demo page when moving the timeScale slider.

I want to animate pausing the scene by gradually moving timeScale from 1 to 0 and from 0 to 1 on unpause but the change this causes to the physics is unbearable. So I crestfallenly went to just toggle timeScale between 1 and 0.

After fixing the weird gravity behavior I experienced I came to notice that even with toggling timeScale as described there are errors in simulation.

After pausing+unpausing the scene that way a quick look shows me the following:

  • a stack of resting rects will bounce
  • all bodies will lose all momentum and drop straight down

I found these discussions which seem related to me:

  • #148
  • #280
  • #240

As I investigated I got the impression that values from the previous update call get used which would explain why incorrectnesses build up as you time-scale the simulation.

This pretty much renders varying time-scaling/slow-mo useless...