Pulse physics - Laying a heavy object on an object of light

I am developing a pulsed physics engine, but I have a problem with objects with a large difference in mass.

In each frame, the engine uses pulses to handle collisions. Pulses are applied over several iterations, between each pair of colliding objects. This works well if the objects have the same mass.

But the problem is that when placing a heavy object on top of a light object, the heavy object will force the light object into the ground.

The cause of the problem is that the pulses applied between the two objects are too small, so even after several iterations this will not be enough to withstand gravity on a heavy object.

I believe that there are ways to accurately calculate the necessary impulses, but I'm afraid it is too complicated? So basically I'm looking for some tricks to counter this problem, but without changing the way the engine works.

Thanks for any ideas!

+3
source share
1 answer

Google for "shock propagation", the main idea is that you sort your contacts in the direction of gravity (usually along the y axis), and when you allow the contact, you lock the lower bodies (assign them an infinite mass, which is, invMass = 0.0f, and invInertiaTensor must be a zero matrix) so that they are not "lost". I did not realize this, I am struggling with my own shitty physics engine.

+2
source

Source: https://habr.com/ru/post/1777184/


All Articles