6

我已经读过一些关于它的东西我想用它做一些实现。但我有几个疑问。de AABB 的问题是对象必须是轴对齐的,否则您必须每帧重新计算 bbox,对吗?重新计算成本高吗?还有精度呢,能不能做个碰撞树细分bbox呢?它如何与 AABB 合作?

OBB 是面向对象旋转的,对吧?您必须在游戏初始化之前构建树。我读到它很难实现而且有点贵,但我在精度上获得了很多。但是如果对象在游戏中旋转,bbox 是否会“自动”重新计算其旋转?

哪一个在游戏中最常用,为什么?

先感谢您 :)

4

2 回答 2

5

AABBs、OBBs、Spheres、Capsules...之间的选择取决于您正在运行的模拟类型以及您的约束(通常是实时应用程序)是什么。

您需要评估利弊并做出相应的选择。例如,使用 AABB 的测试非常快,但您需要在对象旋转时重新计算 AABB。但是,如果您正在处理非常复杂的对象并处理BVH,那么更新 AABB 树会非常快,因为您只需要重新计算(“从头开始”)底部的 AABB,较高的那些是从子 AABB 构建的。使用 OBB,测试成本更高,但如果您正在处理刚性对象,则无需重新计算 OBB。

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.

于 2011-11-14T17:05:46.430 回答
3

AFAIK,大多数物理引擎使用 AABBs + 扫描和修剪算法进行碰撞检测的广泛阶段。树对于动态对象之间的碰撞检测几乎没有用处。但是,这些树可以成功地用于静态几何

de AABB 的问题是对象必须是轴对齐的,否则您必须每帧重新计算 bbox,对吗?

是的,每次身体方向变化时都必须重新计算 AABB。但对于盒子、胶囊、锥体、圆柱体来说,这是一种非常便宜的操作。对于多边形模型肯定更昂贵,但低多边形模型的 AABB 计算具有正常的性能。

总而言之,AABB 重新计算优于昂贵的窄相位算法。

于 2011-11-06T18:44:03.700 回答