Motor Physics: sequential impulses

move mouse inside stage, press ‘F’ for more fun

I have now implemented Erin Catto’s Sequential Impulses solver which he presented in his Box2D mini demo. It’s equivalent to the PGS (Projected Gauss Seidel) algorithm when using SI with clamped accumulated impulses. You find more information in his paper.

The flash runs currently very slow because it’s not optimized at all, but so far I’m happy that it works. I really love SI as it overcomes the jitter of objects which also made stacking nearly impossible in the previous version. But I keep my old solver because it’s very fast and great for non-gravity environments or particle-sized objects where jitter was not an issue.

The last (and probably hardest) step is to rewrite all my collision functions to add contact caching capability, which is quite complicated. The Box2D engine only supports (guess what.. boxes) and the collision and contact generation code is far to slow to be enjoyable in flash, so it’s crucial to find a fast solution for this. Once this is done I can concentrate on the API.

5 thoughts on “Motor Physics: sequential impulses”

  1. Looks great Mike!

    I can’t wait to see what you’ll come up with.

    I don’t know if you’ve already seen this, but it’s an open source Java implementation of Box2D with more than boxes. http://www.cokeandcode.com/phys2d/
    Maybe it can help out.

    Good Luck,
    Oz

  2. Yes, I stumbled across phys2d some time ago. But I’m wondering why it’s so slow compared to the C++ version. And my current version already supports all kinds of shapes, but I need to augment them to so they can manage a contact manifold for a feature called warm-starting (mentioned in Erin’s paper) to make the simulation a little more robust.

Comments are closed.