Box2D 多边形未正确碰撞
我正在尝试保存场景并在 iOS 上使用 Box2D 重新加载它,但我遇到的问题是,从文件读取场景后,多边形不会正确碰撞。这是一种排序或半碰撞,就好像多边形是凹的。然而,它们确实可以使用 GLESDebugDraw 正确渲染。我按照多边形的写入顺序读取多边形的顶点,这与它们存储的顺序相同。此时,任何关于正在发生的事情的想法都会有用。谢谢。
I'm trying to save a scene and re-load it using Box2D on iOS but the problem I'm having is that after reading the scene from file the polygons don't collide properly. It's a sort or half collision, as if the polygons were concave. They do however render correctly with GLESDebugDraw. I read the vertices of the polygon in in the same order they are written, which is the same order they are stored. Any ideas as to what's going on would be useful at this point. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我弄清楚那是什么。事实证明我没有保存/读取边缘的法线。我认为它会在构建 b2body 时从顶点生成法线。显然不是。
I worked out what it was. Turns out I wasn't saving/reading the normals for the edges. I thought it would generate the normals from the vertices on construction of the b2body. Apparently not.