Game Engine Architecture

(Ben Green) #1

12.3. The Collision Detection System 609


effi cient to intersect than cylinders or boxes, so they are oft en used to model
objects that are roughly cylindrical, such as the limbs of a human body.


12.3.4.3. Axis-Aligned Bounding Boxes


An axis-aligned bounding box (AABB) is a rectangular volume (technically
known as a cuboid) whose faces are parallel to the axes of the coordinate sys-
tem. Of course, a box that is axis-aligned in one coordinate system will not
necessarily be axis-aligned in another. So we can only speak about an AABB in
the context of the particular coordinate frame(s) with which it aligns.
An AABB can be conveniently defi ned by two points: one containing the
minimum coordinates of the box along each of the three principal axes and the
other containing its maximum coordinates. This is depicted in Figure 12.3.
The primary benefi t of axis-aligned boxes is that they can be tested for
interpenetration with other axis-aligned boxes in a highly effi cient manner.
The big limitation of using AABBs is that they must remain axis-aligned at
all times if their computational advantages are to be maintained. This means
that if an AABB is used to approximate the shape of an object in the game,
the AABB will have to be recalculated whenever that object rotates. Even if
an object is roughly box-shaped, its AABB may degenerate into a very poor
approximation to its shape when the object rotates off -axis. This is shown in
Figure 12.4.


r r

P 1 P 2

Figure 12.2. A capsule can be represented by two points and a radius.


y

xmin xm ax x

ymin

ym ax

Figure 12.3. An axis-aligned box.

Free download pdf