Box2d:为什么不是凹形?

标签 box2d

box2d 似乎不支持凹形状,但我没有找到任何关于为什么不支持凹形状的解释,以及您必须创建多个凸形状才能实现所需形状的事实。仅支持凹形形状以便您只需创建一个形状不是更容易吗?

那么聪明的人能否尝试解释一下为什么 box2d 不支持凹形,例如技术部分等?拥有多个形状而不是一个形状是否会占用更多内存?

这确实可以让世界对我来说更有意义!

最佳答案

Box2D 由 Erin Catto 和 "Box2D is not open contribution" 编写/开发。因此,对于为什么 Box2D 不支持凹形形状的答案,我们必须向他求助。

幸运的是,Box2D 有一个网络论坛,其中包含以下问题(从 2010 年开始,在其一般讨论部分):Why do shapes have to be convex?

Erin's first response is :

I think this explains it well enough: http://en.wikipedia.org/wiki/Separating_axis_theorem

There are techniques for handling concave shapes. They typically require a lot of memory and setup. For example, I've seen some papers that use signed distance maps. But they are often very light on details.

在稍后的讨论中,Erin adds我认为这是一个富有洞察力的 gem :

AFAIK there are no high quality, high performance algorithms for concave narrow-phase collision. As it stands, there is little written about how to compute contact points and normals for convex shapes, let alone concave shapes.

这让我们想到了一个相关的 StackOverflow 问题(2013 年起):Algorithms for collision detection between concave polygons 。迄今为止,这个问题只有一个答案,并且引用了 2003 年的一篇论文。这似乎证实了 Erin 的立场和主张。

关于Box2d:为什么不是凹形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41515307/

相关文章:

objective-c - Box2D 世界大小

java - 使用 Box2D 在 libgdx Actor 上输入监听器

java - Box2D 未检测到碰撞

java - Box2D 和引擎 : app hangs out when creating Joints during ContactListener?

c++ - 带有 cmake 的 Box2D 不会构建 .lib 文件?

c++ - Box2D 不寻常的错误。为什么 +0 可以防止错误?

c++ - 有没有办法在 Box2D 中启用定点计算?

java - Actor LibGDX 的移动

java - 替换在 Body Editor Loader 中创建的用于角色动画的装置

c++ - box2d 迭代