开发者

Impulse based physics - Stacking heavy object on light object

I'm developing an impulse based physics engine, but I have a problem with objects of 开发者_开发问答large mass difference.

At each frame the engine applies impulses to handle collisions. The impulses are applied over a number of iterations, between each pair of colliding objects. This works well if the objects are about the same mass.

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

The cause of the problem is, that the impulses applied between the two objects is too small, so even over a number of iterations, it will not be enough to counter the gravity on the heavy object.

I believe there are ways to accurately calculate the needed impulses, but I fear it's too complicated? So mostly I'm looking for some tricks to counter this problem, but not changing the way the engine works.

Thanks for any ideas!


Google for 'Shock propagation', the basic idea is that you sort your contacts in the direction of gravity (usually along the 'y' axis) and during contact resolution you freeze the lower bodies (assign to them infinite mass, that is, invMass = 0.0f and invInertiaTensor should be a zero matrix) so that they don't 'sink'. I haven't implemented that, i'm struggling with my own crappy physics engine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜