Game Development Reference
In-Depth Information
To apply this rotation we use equation 9.8, via the quaternion function updateByVec-
tor that we defined earlier.
14.3.3
A VOIDING E XCESSIVE R OTATION
There are two issues to address with the algorithm presented so far. The first is an
assumption that slipped in without being commented on, and the second is a poten-
tial problem that can cause instability and odd-looking behavior. Both are related to
objects being rotated too much as they are moved out of penetration.
Figure 14.8 shows an object that has been severely interpenetrated. If the moment
of inertia of the object is small but its mass is large, then most of the extraction will
be down to angular movement. Clearly, no matter how much angular movement is
imposed, the contact point will never get out of the object. The example is extreme,
of course, but the problem is very real.
The instant an object begins rotating from an impulsive torque, the contact point
will also begin to move. We have assumed that we can take the instantaneous change
in position of the contact point (i.e., its velocity) and use that to work out how much
rotation is needed. Making this assumption means that there will always be a solution
for how much rotation to apply, even in cases where no solution really exists (such as
in figure 14.8).
In effect we have assumed that the contact point would continue to move in its
initial direction forever at the same rate. Clearly this is a wrong assumption: the con-
tact point would change its direction of motion as it rotates around the center of mass.
For small rotations the assumption is quite good. And we hope that most interpene-
trations aren't too large.
For large rotations we have another problem, however. We have the possibility
that we might rotate the object so far that the contact point will start to get closer
F IGURE 14.8
Angular motion cannot resolve the interpenetration.