View Full Version : Collision

09-01-2002, 11:19 PM
I am loading and rendering models from .3ds files, i was wondering what is the easiest and quickest way to check if any of them are colliding.

09-02-2002, 02:28 AM
Use an axis-aligned bounding box. To calculate the box, loop through all of your vertices and find the maximum and minimum x,y,z values, and store them. Then the 8 corners of the box are like:

(min_x, min_y, min_z)
(max_x, min_y, min_z)
(max_x, max_y, min_z)

To check if two axis aligned boxes collide, you see if any of the corners of one box are inside the other. This can be accomplished with a loop and simple < and > comparisons.