1
\$\begingroup\$

In my game I need to be able to find the points of intersection between two OBBs.

I'm using Separate Axis Theorem to check if there's an intersection and get the penetration vector if there is one.

Can I use SAT to also solve this problem? If not, how can I solve this?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

I assume that we're in 2D, and by intersection points you mean the points where an edge of one OBB touches an edge of the other. SAT won't give you those points, but you can easily find them with a simple line segment intersection test (such as the one in this SO answer), applied to each pair of edges. There are 16 such pairs, so it's not a huge amount of work to simply check all of them.

\$\endgroup\$
1
  • \$\begingroup\$ If you have access to the SAT code, you can make use of its data to check the intersections, so you can cut out some operations. \$\endgroup\$ Jul 31, 2014 at 6:27
0
\$\begingroup\$

An alternate (but potentially more difficult) method to solving OBB vs OBB collision is to transform one OBB into the space of the other, such that one of the OBBs becomes axis aligned.

Basically you translate the two OBBs so that the center point of one is at (0,0) then rotate the two around (0,0) until the OBB at (0,0) becomes axis aligned. You can then use SAT to resolve the collision, but all resulting values will be relative to the current transformation (and thus you'll have to un-rotate around (0,0) and un-transoform)

tldr; Linear Algebra + SAT

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .