   How can I implement warmstart?
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?
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.  ;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!   ;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.;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?;  Base your engine on Box2d Lite and study all of the GDC presentations and you will be fine! :)   