Game Development Reference
In-Depth Information
the objects are already penetrating, or that a collision is about to occur
in this time step. The second step is to take measures to resolve or pre-
vent the collision. The former task is known as collision detection, and
the latter as collision response. Our purpose at this time is to discuss
collisions in theoretical terms (we touch on a few practical issues related
to how physics simulations really work in Section 12.6) , so for now let us
merely attempt a general explanation of how the momentum of rigid bod-
ies changes in response to collision. We assume that we already know that
two objects have collided, and we wish to predict their behavior after the
collision.
To do this, either in the abstract in a physics problem, or in collision
response code in a digital simulation, we typically need to know not just
that two objects have collided, but also where they collided, and how the
two objects were oriented relative to each other at the point of contact.
For example, in the car crash between Grant and Kari, we need to know
that Grant's car was hit near the left door, and Kari's in her right front
fender. Of course, a collision doesn't necessarily happen at a single point.
Often an edge of one object may touch a surface of another, or perhaps
entire surfaces are in contact. At the time of this writing, most real-time
collision detection systems do not return collisions in such a descriptive
manner, nor are collision response systems really capable of making use of
that extra information. The closest we get is for the detection system to
locate several points of contact (or penetration) and then to process that
list in some way (for example, by finding their convex hull or looking for
an average surface normal). In any case, the best way to do this quickly
is very much at the forefront of research, and as such doesn't belong in an
introductory book like this. Here we just consider the principles involved
in a single point of contact. More advanced techniques build upon these
principles.
Figure 12.12 shows some example collision results that might be re-
turned from a collision detection system. Note that each collision result
(black arrow) has a point of contact (at the tail of the arrow), and a sur-
face normal, usually assumed to be a unit vector. An arbitrary convention
is chosen for which way the normal will point; in Figure 12.12 it points away
from the “first” object. Furthermore, the two objects may be arbitrarily
assigned the roles of “first” and “second” objects, perhaps by the luck of the
draw that the objects happened to be in some space-partitioning structure.
These assignments can even vary frame-by-frame, so the response calcula-
tion must be symmetric. What is not depicted in the diagram is that a
penetration depth is often returned if the objects are already penetrating.
And always, we should bear in mind the first law of video game physics.
Not all collisions in video games must be between “real” objects, meaning
those objects that are represented in the physics system. For example,
Search WWH ::




Custom Search