Sign in to follow this  

How can I implement warmstart?

This topic is 835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody; I am making my own impulse based physics engine, I noticed that when a body is standing on top of another body (2 boxes) it slides to the left with no reason, reading in this forum I read in a post with a similar problem that warmstart helped to mitigate this issue, but I cant find a tutorial on warmstart or how to implement it.

 

Can you help me with this?

Share this post


Link to post
Share on other sites

This has been exhaustively discussed in the Game Physics Tutorial at the GDC over the years. You can find all presentations here:

http://box2d.org/downloads/

 

In particular "Fast and Simple Physics using Sequential Impulses" from 2006. It comes with a stripped down 2D implementation of Box2D (called Box2D Lite). I would starting studying this.  

Share this post


Link to post
Share on other sites

Boxes sliding on top of each other is not so much what warmstarting is for. At least... unless I've grossly misunderstood its purpose.

 

Warmstarting is for having the simulation converge more quickly, which allows for better accuracy with the same number of iterations (or fewer iterations with the same accurracy, saving CPU), What you do is, you remember the resulting impulses from the last frame and feed them in at the beginning of the next frame's simulation. The assumption here is that there is a kind of coherence between two frames, that is, an object that is moving this millisecond will probably still move in the same direction the next millisecond, so this is a good starting point. For real objects that aren't sub-atomar particles, that assumption is indeed true most of the time (unless they bump into something).

 

To avoid stacked boxes sliding (or, in general, to avoid inactive objects drifting/moving), you stop simulating objects which have impulses below some threshold.

 

http://box2d.org/downloads/
Awesome collection! Edited by samoth

Share this post


Link to post
Share on other sites

Warmstarting has a huge effect on the friction. Actually friction is improved dramatically.

 

Warmstarting also doesn't make the simulation converge more quickly. You essentially converge now over several frames utilizing temporal coherence instead of trying to find the solution each frame.

 

Sleeping is an optimization to avoid unnecessarily computations, not to hide problems in your solver.

Share this post


Link to post
Share on other sites

thanks for your responses; those downloads at box2d are great

 

my engine is based on the engine built on the book Game Physics Engine Development, maybe that is why I cant see how to implement warmstar or accumulated impulses, could it be?

Share this post


Link to post
Share on other sites

This topic is 835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this