Rigid Body collision response
Members - Reputation: 166
Posted 17 August 2012 - 04:45 PM
Members - Reputation: 631
Posted 17 August 2012 - 05:07 PM
Members - Reputation: 166
Posted 17 August 2012 - 05:18 PM
The sequential impulse method does not assume interpenetration to be solved. If you check the slides there are some equations with a parameter beta, which controls the speed in which interpenetration is solved. Impulses are applied such that the constraints are fulfilled. Where the constraints also include interpenetration constraints. The parameter beta adds some additional impulse to not only keep the bodies from penetrating further, but to move them apart.
thanks, i've been wondering for a while now rather sequential impulse only solve for velocity or both velocity and interpenetration. I guess i will look over the slides again
Members - Reputation: 896
Posted 18 August 2012 - 11:57 PM
The vanilla sequential impulse method doesn't deal with interpenetration, though it is a natural outcome of discrete time step simulation (even with CCD, since that can't always detect all future penetrations).
In order to resolve penetrations and push intersecting objects away from each other you need to know the current penetration distance D. Most physics engines will use a velocity-based correction method ('bias' velocity). The difference between bias velocity and normal velocity is that bias velocity is only valid for a single frame, it gets reset to 0 after each simulation step. This keeps objects from continuing to move away from each other after they have separated.
The bias velocity is the accumulation of bias impulses computed in order to counteract any penetration, they behave and are computed exactly like regular normal-direction impulses except that they satisfy a different constraint. Most systems will compute the magnitude of the bias impulse for a particular 2-body pair to be enough to push them say 50% of the way apart in one timestep (not 100% because that can cause bouncy simulations).
biasImpulse = 0.5*D*normalMass / timestep;
where normalMass is the combined inertia of the two bodies along the normal direction. The stability can be improved even more if you disregard penetrations smaller than a certain amount (say a few mm).
Thus, your integration loop will look something like this (with a symplectic Euler integrator):
[source lang="cpp"]Vec force = computeForces( object );object.velocity += (force/object.mass)*timestep;object.biasVelocity = 0;findCollisions(); // Finds contact points, normals, and penetration distances.solveCollisions() // This is where the sequential impulse constraints get solved.object.position += (object.velocity + object.biasVelocity)*timestep;[/source]