Changing Time Scale Affects Physics
See original GitHub issueChanging 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:
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…
Issue Analytics
- State:
- Created 7 years ago
- Reactions:12
- Comments:9
Top GitHub Comments
To my knowledge, no. This was a blocker for me and I won’t do another project with matter-js until this was fixed. I even could have lived without time-scaling, but low FPS have the same effect.
Beware that the issue will likely resurface for you when your simulation becomes too extensive to run the speed-up in realtime, @Nathan-Devery.