Game Development Reference
In-Depth Information
F IGURE 15.3
Micro-collisions replace reaction forces.
a while), the block accelerates so it has a velocity into the ground. The velocity reso-
lution system calculates the impulse needed to remove that velocity.
These little impulses are sometimes called “micro-collisions.” Their use is a well-
known technique for generating reaction forces, but suffers from an undeserved rep-
utation for producing unstable simulations.
If you run the physics engine from chapter 14, you will see that objects don't sink
into one another, even though there is no reaction force at work. Micro-collisions
are already at work: at each update objects are building up velocity, only to have the
velocity resolution algorithm treat contacts as collisions and remove the velocity.
There are two significant problems with treating resting contacts as collisions.
The first has to do with the way collisions bounce. Recall that the separation speed
at a contact point is calculated as a fixed ratio of the closing speed, in the opposite
direction. This ratio is the coefficient of restitution.
If we have a contact such as that shown in figure 15.3, after the rigid-body update,
the velocity into the ground will have built up. During the velocity resolution process
this velocity will be removed. The desired final velocity will be
v s =−
cv s
where v s is the velocity before the collision is processed, v s
is the same velocity after
processing, and c is the coefficient of restitution.
So whatever velocity built up over the course of the interval between updates will
cause a little “bounce” to occur. If our sphere on the ground had a high c value, the
downward velocity would generate an upward velocity.
But in reality the downward velocity never gets a chance to build up. The sphere
can't really accelerate into the ground. The velocity it accumulates is physically im-
possible. This has the effect of making resting contacts appear to vibrate. The objects
accelerate together, building up velocity that then causes the collision algorithm to
give them a separating velocity. The sphere on the ground bounces up until gravity
brings it back down, whereupon it bounces again. It will never settle to rest, but will
appear to vibrate.
Setting a lower coefficient of restitution will help but limits the kinds of situations
that can be modeled. A more useful solution involves making two changes:
Search Nedrilad ::

Custom Search