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

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我认为是一个富有洞察力的宝石:

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年的论文.这似乎证实了艾琳的立场和主张.

点赞