question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing Time Scale Affects Physics

See original GitHub issue

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:

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:open
  • Created 7 years ago
  • Reactions:12
  • Comments:9

github_iconTop GitHub Comments

4reactions
Inve1951commented, Dec 23, 2018

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.

2reactions
Inve1951commented, Dec 26, 2018

Beware that the issue will likely resurface for you when your simulation becomes too extensive to run the speed-up in realtime, @Nathan-Devery.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Time.timeScale is Having a Strange Effect on Physics
Time.timeScale affects everything except physics. ... Changing time scale doesnt affect the efficiency of the physics engine.
Read more >
Time scale - Wikipedia
Dynamical time scale, in stellar physics, the time in which changes in one part of a body can be communicated to the rest...
Read more >
Changing Time.timescale on single objects : r/Unity3D - Reddit
Any time the timeScale is changed, all velocities (Linear and angular) on the object must be changed to counteract the change in the...
Read more >
Timescale changes cause rope to jump around - Obi
Scale.html), I am changing both timescale and modifying Time. ... no matter what physics engine you use (as it affects convergence speed), ...
Read more >
Physics behavior not paused when object time scale = 0
There's nothing wrong. Setting time scale to 0 has no effect on physics in motion. I had the same issue in a game....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found