1
$\begingroup$

In my 2-dimensional physics simulation, I have a rectangular rigid body 'a' with infinite mass (the floor), and a rectangular rigid body 'b' with finite mass above it turned at a slight angle. When rigid body 'b' drops onto rigid body 'a', how do I compute the new linear and angular velocity of rigid body 'b' in an impulse-based contact resolution system?

My current implementation seems faulty because the new linear velocity $v_{new}$ of the body is computed from the old velocity $v_{old}$ of the body at the contact point $\vec r_c$. In other words, the new speed is equal to the old speed plus the perpendicular of the vector to the contact point, dot the contact normal (assuming a coefficient of restitution of 1 for all bodies involved):

$$v_{new} = v_{old} + (\vec r_c)_\bot \cdot \vec n_c$$

This seems wrong, because if rigid body 'b' is dropped onto rigid body 'a' (the floor) at an angle, rigid body 'b' bounces to the same height it had been dropped from, this time with angular velocity. Then, when it falls again, using the above-mentioned algorithm to compute the new separating velocity, rigid body 'b' bounces higher than it was dropped from. It continues this pattern until it hits the ground with so much force (because my engine lacks air drag and therefore terminal velocity) that it goes all the way through rigid body 'a'.

This algorithm seems flawed, but it also seems to be what is implemented everywhere in physics engines. Is my interpretation of these implementations wrong, and the algorithm above completely false? If so, how should I resolve contacts instead? If not, what am I missing?

Thanks in advance!

I apologize if this appears to be a programming question, but (don't tell them I said this) not everyone on StackOverflow knows physics....

$\endgroup$

1 Answer 1

1
$\begingroup$

I understand the question but have not implemented these internals myself; but maybe this observation will help you: when you do the collision response for the inter-penetration contact (with coefficient of restitution > 0) you shouldn't have to apply an impulse so large that the body's CoM actually reflects its velocity - it is enough to apply an impulse exactly so large that the resulting new angular velocity rejects the inter-penetration contact. This is essentially what happens when you drop an angled object onto the floor, it will start rotating but keep falling down.

In slightly other words, due to the difference of the rotational inertia-tensor and the "linear" mass inertia, an impulse at an edge of a rectangular object can obviously be large enough to cause the object to start rotating even though its linear velocity is not really slowed down (or reflected).

I think the impulse magnitude selection is the problem in your implementation, not the application of the impulse. You need to work backwards through the inertia tensor etc. to find the proper impulse that resolves the contact. If you give a too large impulse, obviously the energy conservation of the system will be upset.

Hope this helps, and do tell me if it did or if the problem was somewhere else so I can update the answer if so :)

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.