1
\$\begingroup\$

Is there any easy way to get an approximate distance between two OOB?

I searched around and people talk about GJK algorithm, however I don't see it returning the distance between two convex objects even they are not colliding.

I don't need to be exact but just sphere checking is not acceptable in my case. Any ideas?

\$\endgroup\$
3
  • \$\begingroup\$ Excuse my poor knowledge. I wonder what OOB and GJK stand for. Also I wonder what the distance is, the length of the smallest connection or the distance between the centers of the bodies. \$\endgroup\$ Commented Sep 5, 2014 at 9:11
  • 1
    \$\begingroup\$ @Trilarion: I assume OOB = Object Oriented (Bounding) Box as opposed to AABB (Axis Aligned Bounding Box). GJK = Gilbert–Johnson–Keerthi distance algorithm \$\endgroup\$ Commented Sep 5, 2014 at 11:24
  • \$\begingroup\$ @NachoChip: This might give you some ideas: gamedev.net/topic/… \$\endgroup\$ Commented Sep 5, 2014 at 11:25

1 Answer 1

1
\$\begingroup\$

I take that you meant OBB. (Oriented bounding box)

For an approximate distance calculate it as an AABB.

For an exact distance you can use the Separation Axis Theorem or the Minkowski Difference.

The Minkowski Difference will give you the distance between them (the penetration vector if they are colliding). With SAT you get the distance in each dimension and you have to calculate the vector yourself.

\$\endgroup\$
0

You must log in to answer this question.

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