Recommended Posts

I have a problem. I know how to make a simple 2D collision detection function using bounding boxes, but that only works when the bounding box is perfectly "straight", like the image here:
|||||||||
|||||||||
|||||||||
|||||||||
Now that I am making a 3D FPS, I need to find a way to test for collision between a point and a bounding box that is at an angle, Like the image here.
..////////
.////////
////////
Does anyone know of a way to check for these kinds of collision
[Edited by - Sir Sapo on December 31, 2004 7:01:06 PM]

0

Share this post

Link to post

Share on other sites

Have one large bounding box and sub boxes that are smaller.Then, if their is a collsion with the big box check the smaller more accurate boxes for a collision. You can make them as small as you need. The large box is to save time and CPU. There is no point checking each small box when there might not even be a thing around it.

Share this post

Link to post

Share on other sites

What you want is an OBB (oriented bounding box). Google or search the archives here for 'obb' and you will find a wealth of information.

An OBB is similar to an AABB (axis-aligned bounding box) in that it has a center and three half-extents (its 'radii' in the x, y and z directions). However, an OBB also has a set of three orthonormal axes that represent its orientation in 3D space.

Do you know how to use a 4x4 (or 4x3) transformation matrix to transform a point from one space to another? An OBB's center and axes form such a matrix, and you can use this to transform a point in world space into 'OBB space'. Once you've done that, finding out whether the point intersects the OBB is a simple matter of checking its x, y and z components against the OBB extents.

There are also good algorithms for intersecting OBBs with other OBBs, spheres, lines, etc. Google and you'll find them!

Good luck.

P.S. At least I *think* you want an OBB, but maybe I'm misinterpreting your question (and your ASCII diagram, which by necessity is a parallelogram rather than an OBB). So if I'm off-base, never mind.

0

Share this post

Link to post

Share on other sites

This topic is 4730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.