Game Development Reference
In-Depth Information
F IGURE 14.2
Three objects with different bounce characteristics.
figure the closing velocity and the coefficient of restitution at the point of contact are
the same, so the separating velocity is the same too.
The first object is lightweight and is colliding almost head on. For any force that
is generated during the collision the corresponding torque will be small, because f
is almost parallel to p f . Its bounce will be mostly linear, with only a small rotational
component.
The second object is heavier but has a very small moment of inertia about the Z
axis. It is colliding off center. Here the torque generated will be large, and because the
moment of inertia is very small, there will be a big rotational response. The rotational
response is so large, in fact, that the linear component isn't large enough to bounce the
object upward. Although the point of contact bounces back up (at the same velocity
as the point of contact in each other case), it is the rotation of the object that is doing
most of the separating, so the linear motion continues downward at a slightly slower
rate. You can observe this if you drop a ruler on the ground in the configuration
shown in figure 14.2. The ruler will start spinning away from the point of contact
rapidly, but as a whole it will not leap back into the air. The rotation is taking the bulk
of the responsibility for separating the points of contact.
The third object in the figure collides in the same way as the second. In this case,
however, although the mass is the same, its moment of inertia is much greater. It
represents an object with more mass in its extreme parts. Here the compression force
causes a much lower amount of rotation. The linear impulse is greater and the impul-
sive torque is smaller. The object bounces linearly and the compression force reverses
the direction of rotation, but the resulting angular velocity is very small.
14.1.3
H ANDLING R OTATING C OLLISIONS
Just as for particle collisions, we need two parts to our collision response. First we
need to resolve the relative motion of the two objects by applying impulse and impul-
sive torque. When we process a collision for velocity, we need to calculate four values:
the impulse and impulsive torque for both objects in the collision. Calculating the
balance of linear and angular impulse to apply is a complex task and involves some
complicated mathematics, as we'll see in the next section.