Collision Detection Using AABB or OBB doubts
Asked Answered
I

2

6

I have read something about it I want to to do some implementation using this. But I have a few doubts. The problem with de AABB is that the objects must be axis aligned, otherwise you have to be recalculating the bbox every frame, is that right? Is that recalculation expensive? And what about the precision, can you make a collision tree subdividing the bbox? How it works with AABB?

The OBB is oriented to the object rotation, right? You have to build the tree before the game initializes. I read its a lot harder to implement and bit expensive but I gain a lot in precision. But what if the object rotates in the game, does the bbox will recalculate its rotation 'automatically'?

Which one is most used in games and why?

Thank you in advance :)

Interlineate answered 25/9, 2011 at 19:50 Comment(0)
P
3

AFAIK, the majority of physics engine uses AABBs + sweep-and-prune algorithm for the broad phase of collision detection. Trees are almost useless for collision detection between dynamic objects. However, the trees can be successfully used for static geometry

The problem with de AABB is that the objects must be axis aligned, otherwise you have to be recalculating the bbox every frame, is that right?

Yes, AABB must be recalculated on every change of body orientation. But it's a very cheap operation for boxes, capsules, cones, cylinders. For polygonal models is surely more expensive, but AABB computation for low-poly models has a normal performance.

All in all, AABB recalculation is better than expensive narrow-phase algorithms.

Pate answered 6/11, 2011 at 18:44 Comment(0)
H
5

The choice between AABBs, OBBs, Spheres, Capsules... depends on the kind of simulation you are running and what your constraints (usually real-time applications) are.

You need to evaluate pros and cons and do your choice accordingly. For instance, tests with AABBs are very fast, but you need to recompute the AABBs when your object rotates. However, if you are handling very complex objects and deal with BVH, updating an AABB-tree is quite fast since you only need to recompute ("from scratch") the bottom AABBs, the higher ones being constructed from the child AABBs. With OBBs, tests are costlier but you will not need to recompute your OBBs if you are dealing with rigid objects.

If you decide to use deformable objects, the AABB tree (or Sphere tree) is definitely a better idea, since your tree will need to be updated anyway.

The question is : what will be costlier, the overhead resulting from the updating AABB-tree or from the overlap tests with OBBs? All of this depends on your simulations : objects complexity, average CD tests per sec etc... You can find some benchmarks of different CD libraries based on different methods (BVH, grids...) with different shapes, tested on particular problems. Here is an example that you might find interesting.

Concerning the implementation, since all of this has been researched years ago and implemented in many libraries, you should not have any troubles. You could take a look at Real-Time Collision Detection by Christer Ericson, all of those questions are answered and explained very clearly.

You can also use a mix between different shapes, e.g. one for the broad phase and another one for the narrow phase (once you reach leaves), but you will probably not need something like this.

Homologize answered 14/11, 2011 at 17:5 Comment(0)
P
3

AFAIK, the majority of physics engine uses AABBs + sweep-and-prune algorithm for the broad phase of collision detection. Trees are almost useless for collision detection between dynamic objects. However, the trees can be successfully used for static geometry

The problem with de AABB is that the objects must be axis aligned, otherwise you have to be recalculating the bbox every frame, is that right?

Yes, AABB must be recalculated on every change of body orientation. But it's a very cheap operation for boxes, capsules, cones, cylinders. For polygonal models is surely more expensive, but AABB computation for low-poly models has a normal performance.

All in all, AABB recalculation is better than expensive narrow-phase algorithms.

Pate answered 6/11, 2011 at 18:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.