Game Development Reference
In-Depth Information
Linear and Angular Impulse
In the previous section, you were able to work through the specific examples by hand
using the principle of conservation of momentum and the coefficient of restitution. This
approach will suffice if you're writing games where the collision events are well defined
and anticipated. However, if you're writing a real-time simulation where objects, espe‐
cially arbitrarily shaped rigid bodies, may or may not collide, then you'll want to use a
more general approach. This approach involves the use of formulas to calculate the
actual impulse between colliding objects so that you can apply this impulse to each
object, instantly changing its velocity. In this section, we'll derive the equations for
impulse, both linear and angular, and we'll show you how to implement these equations
in code in Chapter 10 .
When you're dealing with particles or spheres, the only impulse formula that you'll need
is that for linear impulse, which will allow you to calculate the new linear velocities of
the objects after impact. So, the first formula that we'll derive for you is that for linear
impulse between two colliding objects, as shown in Figure 5-4 .
Figure 5-4. Two colliding particles (or spheres)
For now, assume the collision is frictionless and the line of action of the impulse is along
the line connecting the centers of mass of the two objects. This line is normal to the
surfaces of both objects.
To derive the formula for linear impulse, you have to consider the formula from the
definition of impulse along with the formula for coefficient of restitution. Here let J
represent the impulse:
| J | = m (| v + | − | v |)
Search Nedrilad ::

Custom Search