Sign in to follow this  

Multiple contact points in rigid body dynamics

This topic is 2540 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

I've just read Chris Heckers tutorials on rigid body dynamics, in 2D. It works pretty well for circle/line collisions, but I've started to think about multiple contact points. What happens when, say, an edge of a polygon collides with the edge of another polygon? I don't really want to implement it yet, so this question is purly theoretical. If I want to solve it exactly, what equations would I use and what's the physics behind it? Should I integrate the impulses over the contact manifold or something like that?

Share this post


Link to post
Share on other sites
You'll get a system of equations, where each equation is one of the contacts taken in isolation. You'd solve for all contacts simultaneously, or solve them all sequentially a few times (an "iterative" solution) and hope the result converges to an answer.

If you want to solve it exactly you'd probably go the simultaneous solving route, but it's usually considered too expensive for run time situations. So it makes sense mostly for offline rendering (eg: Pixar) and things like that. Or if the number of constraints (contact points + other stuff) in your world is small (maybe no more than a few dozen).

Iterative solutions have the advantage that you can throw however much time you want at the problem and get some sort of solution, so they work well for runtime situations like games, but they often introduce "jitter" because they don't solve the equations exactly.

To learn more, you'll need to become comfortable with forming the "Jacobian" of the constrained system and formulating the "linear complementarity problem" of the system to handle contact forces (which can push but not pull). Erin Catto's GDC presentations are a good next step after you really understand Hecker's articles. They use totally different notation, so it definitely takes some thought and effort before Catto's presentation will "click". But after it does, you'll have the necessary background to approach things like Linear-Time Dynamics using Lagrange Multipliers, which shows the advantage of approaching the problem from a linear algebra standpoint (you can use some sparse matrix tricks), but definitely some very high level ideas going on.

This math isn't too hard but you have to wrap your brain around some high level linear algebra, which makes the learning curve really steep.

The iterative solutions have the advantage that you can pretty much be ignorant about the math and get something working decently just by hacking around in code (though you'd obviously be better off understanding the math behind it, too).

There are also hybrid approaches where you solve the system iteratively N constraints at a time. Like, maybe you solve all 4 constraints between 2 bodies at the same time, then move on to the next body pair. They combine the best of both worlds, but you also have to actually understand both worlds :)

Share this post


Link to post
Share on other sites
Thanks a lot for your reply!

I've looked at Box2D Lite, and while it seems pretty easy to implement, it's no fun if you don't understand the theory :) I'll read the article by Erin Catto and try to wrap my mind around the Jacobian.

Share this post


Link to post
Share on other sites

This topic is 2540 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