288 Chapter 12 Collision Detection
object and objects in the same or neighboring cells (there are a maximum of three
neighbors to check now because objects can’t be in a grid cell that is smaller than they
are). In addition, the object is check ed against all objects in all cells in larger-celled
grids that overlap.
We don’t need to check against objects in smaller-celled grids, because the small
objects are responsible for checking against larger objects.
For each grid in the map, we can use the grid data structure with the same set
of occupied cells. However, we need to add a cell to the active list if it contains any
objects at all (they may be in contact with neighbo rs).
12.5 Summary
Collision detection is a complex and time-consuming process.