Game Development Reference
Your scene will have bounding boxes that will never collide. The first
rule of real-time applications is only calculate what is essential. If a
bounding box can never collide with another, then do not test them for
collisions. The axis-aligned bounding box approach gives a good first
check for a collision. It is fairly low in the computational hit apart from one
major flaw; graphics cards are increasingly able to do all the transforma-
tions, relieving the processor of this computationally expensive work. The
maximum and minimum vertex bounding box approach is rather reliant on
the processor doing the transformation work, so that you can derive the
world values for maximum and minimum values for the character's
bounding box in world coordinates. You can get around this problem by
having a fixed bounding box that you transform using the graphics
hardware matrix which you can get from OpenGL after setting up the
camera location. You can then use this matrix to transform just the two
vertices in the fixed bounding box.
An alternative approach to using bounding boxes for the basic collision
testing is to use spheres centred on the collision targets.
To get a basic test for a collision you need only check that the distance
from the character's bounding sphere centre to the centre of each
collision sphere in the set is less than the combined radii of the two
Figure 13.3 Using bounding spheres.