Game Development Reference
In-Depth Information
5.3 Collision Detection
Collision detection is the process of determining when two objects are about to collide or
have already collided. In most video games, this process has been simplified: image that you
draw a rectangle (ie. bounding box) or circle (ie. bounding sphere) around the object and
the rectangle (circle) is just big enough that all contents of the object fit into it. In this case,
all you have to do is just to detect when two rectangles (circles) in the Canvas Coordinate
System are about to overlap or have already overlapped.
Figure 5.4 Overlapping Rectangles
Consider figure 5.4, if the overlapped area is larger than a given threshold, then the 2 rect-
angles are thought to be “Collided”. Here is the snippet:
Search WWH ::




Custom Search