This project has moved and is read-only. For the latest updates, please go here.

Pausing the Physics Engine

Jan 6, 2008 at 9:43 AM
Im trying to pause the physics engine by setting all the Body's to disabled, which works fine.
But as soon as I add a Spring and set the Body's to disabled then re-enable them the spring tries to "catchup" the missing frames (if that makes sense)

Is there anyway to disable/re-enable the springs?
Jan 6, 2008 at 10:36 AM
How about not calling Physics.Update() while pausing?
Jan 6, 2008 at 11:44 AM
yes, a better way to pause everything is to just not call update.
Jan 6, 2008 at 2:13 PM
only problem with that is during the pause im adding new bodies / geoms / joints / springs ... and if paused it doesn't visually show (i.e. in the physics debug view) until update is called.
Jan 6, 2008 at 3:37 PM
Hmm, I guess what is needed is an enabled/disabled property on the spring object so you could turn that off along with everything else.

You could modify the LinearSpring code your self and add that functionality.

Another option, which would be a bit of a hack and I'm not sure it would work it so call update and pass 0 for an elapsed time. If that doesn't work just call update once while paused after you added all the objects you want.

Hope this helps. I'll put add an Enabled property to the spring for the next release.

Dec 6, 2012 at 11:13 AM

I just discovered, it was so easy to pause the physics, call World.Enabled = false; set it to true for resume