616 12. Collision and Rigid Body Dynamics
axis is the one parallel to the center-to-center line segment. As the spheres
move apart, we can rotate the separating axis more and more in either direc-
tion. This is shown in Figure 12.11.
12.3.5.4. AABB versus AABB
To determine whether two AABBs are intersecting, we can again apply the
separating axis theorem. The fact that the faces of both AABBs are guaranteed
to lie parallel to a common set of coordinate axes tells us that if a separating
axis exists, it will be one of these three coordinate axes.
So, to test for intersections between two AABBs, which we’ll call A and B,
we merely inspect the minimum and maximum coordinates of the two boxes
along each axis independently. Along the x-axis, we have the two intervals
[xminA , xmaxA ] and [xBmin, xmaxB ], and we have corresponding intervals for the y- and
z-axes. If the intervals overlap along all three axes, then the two AABBs are in-
tersecting—in all other cases, they are not. Examples of intersecting and non-
intersecting AABBs are shown in Figure 12.12 (simplifi ed to two dimensions
for the purposes of illustration). For an in-depth discussion of AABB collision,
see htt p://www.gamasutra.com/features/20000203/lander_01.htm.
Separatin
g
Line/Plane
Separatin
gAxis Many
Separati
ngAxes
Many
Separatin
g
Lines/Pla
nes
Figure 12.11. When two spheres are an infi nitesimal distance apart, the only separating axis
lies parallel to the line segment formed by the two spheres’ center points.
y
x
y
x
Figure 12.12. A two-dimensional example of intersecting and non-intersecting AABBs. Notice
that even though the second pair of AABBs are intersecting along the x-axis, they are not
intersecting along the y-axis.