What is AABB - Collision detection?

流过昼夜 提交于 2019-11-27 07:23:58
jwd

AABB stands for "Axis-Aligned Bounding Box."

It is a fairly computationally- and memory-efficient way of representing a volume, typically used to see if two objects might be touching.

Since it is axis-aligned, it does not necessarily "fit" your real 3D object very well. AABB checks are often used as a coarse first-approximation to see if objects might be colliding. Then, if the AABB check passes, more detailed checks are made.

Example:

Imagine your world is 2D, and you draw it on a sheet of graph paper. You have some objects in the world (a ball, a tree, whatever). To make an AABB for one of the objects, you draw a rectangle around the object, making your lines parallel to the grid lines on the paper.

If you have the AABB for two objects, you can do some pretty simple math to see if those AABBs overlap. If they don't overlap, those two objects couldn't possibly be touching, so it's an easy early-out for your collision algorithm.

This generalizes to 3D (and more-Ds) fairly easily.

You might want to check out gamedev.stackexchange.com, too.

Axis Aligned Bounding Box

Basically its the smallest Cuboid that can completely contain the shape, usually defined by a pair of 3d co-ordinates.

It's very fast to check for collisions between two AABB as all you need to do is check the range of the X, Y and Z values for the corners.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!