Game Development Reference
In-Depth Information
Notice that for the second object, the negative of the impulse is applied since it acts on
both objects equally but in opposite directions.
When dealing with rigid bodies that rotate, you'll have to derive a new equation for
impulse that includes angular effects. You'll use this impulse to calculate new linear and
angular velocities of the objects just after impact. Consider the two objects colliding at
point P , as shown in Figure 5-5 .
Figure 5-5. Two colliding rigid bodies
There's a crucial distinction between this collision and that discussed earlier. In this case,
the velocity at the point of contact on each body is a function of not only the objects'
linear velocity but also their angular velocities, and you'll have to recall from Chap‐
ter 2 the following formula in order to calculate the velocities at the impact point on
each body:
v p = v g + ( ω × r )
In this relation, r is the vector from the body's center of gravity to the point P .
Using this formula, you can rewrite the two formulas relating the linear velocity after
impact to the impulse and initial velocity as follows:
For body 1: v 1g+ + ( ω 1+ × r 1 ) = J /m 1 + v 1g- + ( ω 1- × r 1 )
For body 2: v 2g+ + ( ω 2+ × r 2 ) = - J /m 2 + v 2g- + ( ω 2- × r 2 )
There are two additional unknowns here, the angular velocities after impact, which
means that you need two additional equations. You can get these equations from the
definition of angular impulse:
For body 1: ( r 1 × J ) = I 1 ( ω 1+ - ω 1- )
For body 2: ( r 2 × - J ) = I 2 ( ω 2+ - ω 2- )