Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Collision

  1. #1
    Guest

    Collision

    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.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2002
    Location
    St. Louis, MO USA
    Posts
    181

    Re: Collision

    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)
    ...etc.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •