Game Development Reference
In-Depth Information
Figure 4.1. Equivalency of contact volumes: (a), (c), and (d) show irregular shapes with
contact manifolds that are best approximated by a rectangle; (b) shows a regular rectangle
contact manifold.
Culling contacts is only possible for contacts with (almost) the same normals
and friction. One simple solution to deal with concave objects (and thus varying
normals across contact points) is to put contacts into buckets depending on their
normal. Simple 3
4 cubemaps worked fine in practice for me. If
we assign a contact to a bucket in the cubemap, sometimes very similar contacts
will be in different buckets, but we can have the solver deal with it.
×
3
×
3 or 4
×
4
×
4.3
Physics Engine Pipeline
Very roughly, we can dissect a typical physics simulation loop into pipelined
stages. The same object or simulation island, if not asleep, usually has to “flow”
its data through different stages sequentially. Not all the data about the object(s)
are required at each stage. For example, the constraint solver cares about the ob-
ject's inertia, contact, or constraint points, but not about its geometry. Discrete
collision detection (DCD), and often continuous collision detection (CCD), too,
only care about the object's trajectory and geometry, but not its mass properties.
In this chapter, we're mainly concerned with the DCD stage, dealing with just
two shapes in close contact. This stage is also called the narrow phase of collision
detection, as opposed to the broad phase , where all possible contacting pairs of
objects are detected. Understanding up- and downstream connections is crucial
for making the right choices in implementing this important part of the physics
engine.
4.3.1 Narrow Phase
In the narrow phase, we take two objects in close vicinity (sometimes penetrating)
and find contact points. We then optimize the contacts and form a contact mani-
fold for the solver (see Figure 4.1 ) . In this chapter, we'll describe one algorithm