Jittering due to gravity and restitution

Started by
12 comments, last by Shannon Barber 10 years, 2 months ago

Restitution is a fudge for damping, they both seek to remove energy from the system so that stability is achieved. You should use one or the other, not both.

Your interpretation of how gravity should be applied appears to be flawed. Gravity is a force that acts on the body, your collision should produce another force. You sum these forces to find the acceleration of your body. Assuming you have damping, after a certain number of bounces the force due to gravity and the force due to contact will cancel and the body will be at rest.

Advertisement


Your interpretation of how gravity should be applied appears to be flawed. Gravity is a force that acts on the body, your collision should produce another force. You sum these forces to find the acceleration of your body. Assuming you have damping, after a certain number of bounces the force due to gravity and the force due to contact will cancel and the body will be at rest.

Apologies, my explanation may appear flawed, but I do apply gravity just like you say I should. The jittering arises because of these forces. Say the body is in resting state, and gravity will apply a force making it collide with the body. For the sake of clarity, say this force is exactly (0.0f, -0.05f, 0.0f). Now on collision, due to the restitution choosen, another impulse in the reverse direction is applied - I don't have the exact values, but lets say its somewhere around (0.0f, 0.15f, 0.0f). Now combine those, and the final velocity of the object is (0.0f, 0.1f, 0.0f), which means the body will rise. In the next two frames, the body will fall unhindered, until in the third frame gravity drags it into the floor again, resulting in the force that is pushing it up by (0.0, 0.1f, 0.0f) again, and repeats. The issue is a bit different, but I can't test it right now. Do you still get where I'm going at? The jittering is not caused by the accumulated velocity, but by the initial gravtiy that is added every frame, causing the floor to push the sphere out by a noticable amount due to its restitution. Therefore the body will never come to rest, because even if it has a velocity of exaclty 0.0f, the next step gravity will start the process all over again. As I said, in the "impulse engine" from the tutorial I was following, they cancelled this effect out by setting the restitution to 0 if the velocity is smaller than one-step gravtiy. How is a normal damping/restitution-system supposed to cancel this out anyway?

From that link, and your explanation. It looks like you've worked out how to cancel the jittering when using this restitution technique.

If you were to use a damping system, you would treat your boundary surface as a compressive spring-damper. As the body overlaps the surface you calculate the magnitude of the overlap, the force you apply to the body is then calculated as though you have compressed a spring-damper. So you work out the overlap, then using the stiffness and damping coefficient of the surface you would calculate a proportionate force to be applied to the body.

When using such a system, the body and surface would overlap slightly while the body is at rest. But the overlap would be negligible. This type of collision handling is commonly used in the Discrete Element Method. I am not sure how common it is in Games, as I haven't dug into any of the physics libraries. Though it is how I would implement it. Collision detection tends to be far more expensive then the actual collision handling so you can afford to use a realistic solution in this case :)

Would it be possible for you to add 'adhesion'?

Below a certain threshold between the objects, you cease treating them like separate objects.

Instead the colliding object becomes a sub-node on the larger object's tree.

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement