AABB or OBB error collision detection

I read something about this, I want to do some implementation using this. But I have a few doubts. The problem with AABB is that the objects have to be aligned along the axis, otherwise you have to recalculate the bbox every frame, right? Is recalculation expensive? What about accuracy, can you make a collision tree sharing a bbox? How does it work with AABB?

The OBB is oriented toward rotating an object, right? You must build a tree before playing iniatializates. I read that it is much more difficult to implement and a little expensive, but I get a lot of accuracy. But what if an object rotates in a game, will the bbox recount its rotation “automatically”?

Which one is most commonly used in games and why?

Thank you in advance:)

+4
source share
2 answers

AFAIK, most physical engines use the AABBs + sweep-and-prune algorithm for a wide collision detection phase. Trees are almost useless for detecting collisions between dynamic objects. However, trees can be successfully used for static geometry.

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

Yes, AABB should be recalculated with every change in body orientation. But this is a very cheap operation for boxes, capsules, cones, cylinders. For polygonal models, it’s certainly more expensive, but AABB calculations for low-poly models have normal performance.

In general, AABB recalculation is better than expensive narrow-phase algorithms.

+2
source

The choice between AABB, OBB, spheres, capsules ... depends on what type of simulation you are using and what your limitations are (usually real-time applications).

You need to evaluate the pros and cons and make your choice accordingly. For example, tests with AABB are very fast, but you need to recalculate AABB when your object rotates. However, if you process very complex objects and deal with BVH , updating the AABB tree is pretty fast, since you only need to recount ("from scratch") the lower AABBs, with the higher ones being built from the child AABBs. Tests with OBBs are more expensive, but you will not need to recount your OBBs if you are dealing with hard objects.

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

Question: what will be the more expensive overhead arising from updating the AABB tree or from tests for overlapping with OBB? It all depends on your simulations: complexity of objects, average CD tests per second, etc. You can find some tests of different CD libraries based on different methods (BVH, grids ...) with different forms tested for specific problems. Here is an example that may seem interesting to you.

As for the implementation, since all this was researched many years ago and implemented in many libraries, you should not have any problems. You can take a look at real-time collision detection by Christer Erickson, all of these questions are answered and explained very clearly.

You can also use a combination between different forms, for example. one for the wide phase and the other for the narrow phase (as soon as you reach the leaves), but you probably won't need something like that.

+3
source

All Articles