Game Development Reference
In-Depth Information
penetrating each other. Thirdly, if the hovercraft are colliding, it must tell you what the
collision normal vector is and what the relative velocity is between the colliding hov‐
To determine whether or not there is a collision, you need to consider two factors:
• Whether or not the objects are close enough, within numerical tolerances, to be
considered in colliding contact
• What the relative normal velocity is between the objects
If the objects aren't close to each other, they obviously have not collided. If they are
within your tolerance for contact, then they may be colliding; and if they are touching
and overlapping such that they are moving inside each other, they are penetrating, as
illustrated in Figure 10-1 . If your collision detection routine finds that the two objects
are indeed close enough to be in colliding contact, then you have to do another check
on the relative normal velocity to see if they are moving away from each other or toward
each other. A collision occurs when the objects are in contact and the contact points are
moving toward each other.
Figure 10-1. Collision nomenclature
Penetration is important because if your objects overlap during the simulation, the re‐
sults won't look realistic—you'll have one hovercraft moving inside the other. What you
have to do is detect this penetration condition and then back up your simulation, reduce
the time step, and try again. You keep doing this until they are no longer penetrating or
they are within tolerance to be considered colliding.
You need to determine the normal velocity vector of the collision in order to calculate
the collision impulse that will be used to simulate their response to the collision. For
simple cases, determining this normal vector is fairly straightforward. In the case of
particles or spheres, the collision normal is simply along the line that connects the
Search Nedrilad ::

Custom Search