Skip to main content
gamedev.net
🔒 Locked

OBB tutorials?

Started by Moe Oct 13, 2001 at 2:55 PM 8 replies 4.4k views
Original Post
Moe
Moe
Hi, I was wondering if anyone here has found any tutorials for using Oriented Bounding Boxes. I did find one tutorial at Gamasutra but it was more for AABBs. Also, is it very smart to use an OBB, as compared to using AABB? Any thoughts on the subject are welcome (or any thoughts on collision detection as well).
Scarab0
Scarab0
Looking for this one?
http://www.gamasutra.com/features/19991018/Gomez_5.htm
That''s a link to an OBB-OBB intersection tutorial, the next page (page 6) is about OBB-Line intersections.
Dirk =[Scarab]= Gerrits
Scarab0
Scarab0
Oh I forgot your second question. Silly me. Whether OBBs are better than AABBs depends on what you want to do. OBBs are more computationally expensive but they fit rotating objects better than AABBs.
Dirk =[Scarab]= Gerrits
Moe
Moe
Just another quick question: You say that OBBs are more computationally expensive to test for the actual collision, but isn''t an AABB similarily expensive because you have to re-calculate the bounding box every time the object in it moves?
Scarab0
Scarab0
quote:
Original post by Moe
Just another quick question: You say that OBBs are more computationally expensive to test for the actual collision, but isn''t an AABB similarily expensive because you have to re-calculate the bounding box every time the object in it moves?


You don''t have to recalculate the AABB when the object in it moves. Only when the object rotates. You could however create an AABB for an object that would fit it in every posible orientation. However, the box would not be a very tight fit anymore. That''s what I meant with that second post.
Dirk =[Scarab]= Gerrits
The Wolf
The Wolf
Well you can have a OBB track the bounds of the object, then when you go to get the AABB of the object you just check the 8 corners of the OBB to get the AABB instead of all object vertices. This will give you a ''better'' fitting AABB

Good luck

Wolf
Moe
Moe
I am really becoming tempted to use just regular sphere-sphere collision detection. The only problem with that is the sphere is usually quite a bit larger than the object (say, like a box).
TerranFury
TerranFury
What about cylinders? Using an "AACyl" would work well for player models. An "OCyl"would work well for things like missles. And spheres work well for things like bullets.
Scarab0
Scarab0
Using axis-aligned cylinders is indeed a nice idea. It''s pretty easy to check them against other axis-aligned bounding volumes.

But oriented cylinders?! Madness! Oriented capsules could be good, but believe me, oriented cylinders are a pain in the rear.

NOTE: a capsule is a cylinder with two halfsphere endcaps. Therefore checking intersection with a capsule is simply comparing the distance to the capsule''s linesegment to the capsule''s radius.
Dirk =[Scarab]= Gerrits
no way
no way
I think for real implementation you are best off with multiple implementations.
Eg. first check for bounding spheres. When those are colliding then chec OBBs for intersection, and then for individual polygons.
For complex geometry its best to use several tight-fitting OBBs, for example if you have character models, you would build OBBs around body, head, and limbs. Plus you might wanna organize them hierarchically.

One method of testing two OBBs for intersection is given here
ftp://ftp.cs.unc.edu/pub/users/manocha/PAPERS/COLLISION/sig96.pdf
Chaper 5 "Fast overlap test for OBBs"

The easiest and most inefficient method goes like this:
for each face of the first box test intersection with each edge of the second box (totals 6x12 = 72 tests)
Do the same with boxes swapped, which makes grand total of 2x72 = 144 intersection tests.

Edit: And as Wolf said, calculating AABBs each frame is pretty fast, because you only need to check 8 vertices, those of OBBs
And link on Gamasutra provided by Scarab0 describes the same method as in the paper above.

Edited by - no way on October 17, 2001 12:02:25 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.