Jump to content
  • Advertisement
Sign in to follow this  
Lazy Foo

Collisions, linear momentum and angular momentum

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

So I have this situation in a collision. Two OBBs with a linear velocity (represented with the green arrows), no angular velocity, point of contact (yellow dot), and normal from object A to B (red arrow)
I'm looking to make this a elastic collision. My system allows for angular movement (angular velocity, torque, etc).

My question is, is any the linear momentum from this collision supposed to be turned into angular momentum on collision? My intuition and amnesia of physics says yes.

Share this post

Link to post
Share on other sites
Yes, at a continuous level, there will be angular momentum in the general case: if the red arrow is the force applied to the upper box at the yellow point, as long as it does not go toward the center of mass of the box, it will induce some rotation (I think it's called "torque").

Now if you want to resolve all this in 1 step, I have no idea ... I guess it depends on some "elasticity" parameters.

Share this post

Link to post
Share on other sites
If you want a full deriviation; i can give you one. But basicly:

fun resolve(body b1, body b2, vec contact_point, vec contact_normal, real elasticity in [0,1]) {
vec r1 = b1.position - contact_point;
vec r2 = b2.position - contact_point;
real cx1 = perpdot(contact_normal, r1);
real cx2 = perpdot(contact_normal, r2);

vec vrel = b2.velocity + perpdot(b2.angularVel, r2) - b1.velocity - perpdot(b1.angularVel, r1);
real vdot = dot(contact_normal, vrel);
if(vdot < 0.0d) return; //don't want to do anything if bodies are already seperating. (this depends on whether contact_normal is on body1, or body2 for the sign)

real K = b1.inv_mass + b2.inv_mass + cx1*cx1*b1.inv_inertia + cx2*cx2*b2.inv_inertia;
real lambda = -(1+elasticity) * vdot / K;

vec imp = contact_normal * lambda;
b1.velocity -= imp*b1.inv_mass;
b1.angularVel -= cx1*lambda*b1.inv_inertia;
b2.velocity += imp*b2.inv_mass;
b2.angularVel += cx2*lambda*b2.inv_inertia;

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!