# box collision detection

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

## Recommended Posts

is it possible to detect collisions between two rotated boxes in 3d space the same way you would detect it between two unrotated cubes by applying the transformation matrix to its points or is a more complex method needed.

##### Share on other sites
If the boxes are both in the same orientation, then in their local frame or reference it's a simple axis aligned box collision test, ie do what you suggested and it's reduced to the previous case. If they are not in the same orientation, then you'll need a different method... You could probably be clever and rotate both so as one was axis aligned, then check for vertices penetrating, then edges, then faces (you must cover all of these to cover all possible collision cases, eg a box in a box). If you know more about the possible states the boxes can be in you can try less options. You can also do this in the unrotated frame of reference which may or may not be advantageous. I suggest checking vertices then edges then faces as that reflects the computational cost of each and if you simply want a boolean result... you'll most likely get it faster. If you need more specific details skip straight to face/face collision checks.
Hope this helps,

Dan

##### Share on other sites
Quote:
 Original post by mrcheesewheelYou could probably be clever and rotate both so as one was axis aligned, then check for vertices penetrating, then edges, then faces (you must cover all of these to cover all possible collision cases, eg a box in a box).
As far as I am aware at least, the most straightforward and efficient (or at least most commonly used) method for testing for intersection between oriented boxes is the separating axis test (SAT), which can be optimized to take advantage of the regularity of the box shape (i.e. multiple parallel faces and edges, etc.).

The algorithm for OBB SAT intersection is well documented, so you should be able to find plenty of references online (in fact, I believe it's covered in one of the articles in the 'collision detection' section here on GDNet).

##### Share on other sites
I tried a separating axis test tutorial a while ago but i couldn't wrap me head around it, now I'm not sure if I want to try it again or use ode even though my game doesn't need any physics.

For boxes I'm able to detect if a point is inside it so i wonder if its possible to try to detect the spot where if there is a collision its going to happen and test that point.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631788
• Total Posts
3002356
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!