Search code examples
collision-detectionbounding-boxaabb

Collision Detection Using AABB or OBB doubts


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 :)


Solution

  • 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.