# OBB intersection in 3D

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

## Recommended Posts

If i have 2 OBB's in 3D, how can i tell if they're intersecting? and after i find that they are, how can i find the intersection points? - i'm not sure how to define "intersection points" in 3D and maybe thats part of my problem, but basicly what i mean by IPs are the two points (one on each body) that need to be seperated in order to resolve the collision. there could be multiple sets of IP's for a given collision. For example, if a corner of one box goes into the side of another one there's one set of IPs - the corner of the first box and the point on the intersected plain of the second box that's closest to it. but if two faces collide there're should be 4 sets of IP's. In 2D this is easy, just check if the corners of one box are penetrating another one and use that corner and the closest point on the other box to get a set. but in 3D it's more complicated cause sides can touch without any corners penetrating. If something wasn't clear (i'm not that good at explaining things) please ask. Thanks for the help!

##### Share on other sites
The term to google for is 'separating axis theorem'. The boolean OBB SAT test is even covered (with code) in an article right here on gdnet. Look in the 'collision detection' section for an article called 'Simple Intersection Tests for Games', or something of that sort.

The algorithm can be extended naturally to find the contact points, although it can be a little involved to do so. In involves keeping track of and/or computing the support features along the minimum axis of separation, and then clipping these features together. The most common case (vertex-face) is trivial, while edge-face and face-face require a little more work.

One aspect that's often overlooked is degenerate cross-product axes when the boxes are nearly aligned in one or more dimensions (I don't think this is addressed in the aforementioned article), so keep this in mind when implementing the test.

This topic has been discussed in great detail in these forums in the past, including a recent thread started by starfleetrp (which should still be on the first 5 to 10 pages), and other threads going back a ways in which the above aspects were covered in detail along with illustrative diagrams.

As always, you might check out geometrictools.com, although some aspects of the OBB intersection code there are a little tricky to tease apart.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013743
×