Jump to content
  • Advertisement
Sign in to follow this  
Sirisian

System of equations for contact points.

This topic is 3542 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 always wanted to research this. I know how to solve for just a 1 contact point version of collision response for the velocity. I was wondering what's the method for finding the equations I need to solve. I was quickly thinking of ideas: Do I use both conservation of momentum and energy? Are those the correct equations. The only problem I see if they are is that I only know how to solve linear equations. Those energy equations are quadratic. (I know the inverse matrix method, guass-jordan elimination, and echelon kind of stuff). So are those the right equations. If not which ones do I use. I need N equations for the N unknown velocities I know that. Also that example is just an example. I'm trying to find a method that works on N contact points. Not really worried about speed. This is mostly research since I'm building some physics tests.

Share this post


Link to post
Share on other sites
Advertisement
I try to give you the correct equations later this day. Maybe you search my latest posts since I am sure that I answered this question (or similar) twice recently. Anyway, your equations miss the fact that the contact impulses/forces are only pushing objects apart and do *not* attract each other. Therefore you get inequalities and not a system of linear equations but a linear complementary system (LCP).

Share this post


Link to post
Share on other sites
I assume that for each sphere in your picture I know its position p and orientation R. Additionally I assume that we know the position c and normal n of the three contact points between the spheres.

We seek equal and opposite (momentum conserving) impulses P at each contact point such that the relative velocity at each contact point vanishes or is separating. As already stated the impulses can only push the spheres apart, but not pull them together.

Finally we define the offset vector r from the center of mass of each sphere to the contact point. You now get the following equations. Let the lower left sphere be body 1 and the upper red sphere be body 2. The normal at the contact point points towards the second (red) body.

Let v be the linear velocity, w (omega) be the angular velocity, m is the mass, I is the inertia tensor and P is the equal and opposite impulse. The prime (') denotes that this is the velocity *after* the impulse was applied (post-velocity)

// Impulses at each body
(1) v1' = v1 + P1 / m1
(2) w1' = w1 + ( r1 x P1 ) / I1
(3) v2' = v2 + P2 / m2
(4) w2' = w2 + ( r2 x P2 ) / I2

// We actually know the impulse direction
(5) P = lambda * n and lambda >= 0

// We know that P1 and P2 are equal and opposite
(6) P1 = -P2

// The relative velocity at the contact for the post velocities must vanish
// or be separating
(7) v_rel = ( v2' + w2' x r2 - v1' - w1' x r1 ) * n >= 0

// Either the impulse or the relative post velocity is zero
(8) lambda * v_rel = 0

For the complete system you just write down same equations/inequalities for the other contact points and consider the other impulses in the first four equations.

Share this post


Link to post
Share on other sites
I'm not using SAT. My objects never penetrated one another. When a collision occurs it happens exactly on the boundary. Is this going to still work? I thought you didn't have to use impulses for this kind of stuff. (Also this is 2D)

Also I'm not sure how to solve what you gave me. What is lamda?

I was kind of looking for a way to handle this without impulses. Like when solving for a 2 circle head on collision you simply plug in numbers and it returns the new velocity.

Share this post


Link to post
Share on other sites
This has nothing to do with SAT. Given are n bodies and m contacts. You are looking for the new velocities such that the object will not penetrate. So either the relative velocity at the contact point in the direction of the normal is zero or separating. This change in the velocities comes from the impulses. You need to use the impulses since I don't see any other way how you can make sure that the velocity change is not attracting the bodies. This would be physically wrong.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!