Sign in to follow this  
Lazy Foo

Collisions, linear momentum and angular momentum

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

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