AndEngine 和 box2d 碰撞过滤
我遇到两个物体(一动态一静态)之间碰撞的问题。假设我有墙和球,我设置了过滤器,允许球穿过墙。只要我创建主体在墙体外的精灵,它就可以很好地工作。当我在与墙壁相同的位置创建球然后球被卡住或弹跳或做奇怪的事情时,就会出现问题。我相信,如果有碰撞过滤器,在哪里创建主体应该没有关系。有人有类似问题吗?
I have a problem with collision between 2 bodies(one dynamic and one static). Lets say that I have wall and ball, I set filter which allows the ball to pass through the wall. It works good as long as I create sprite with body outside the wall body. The problem appears when I create ball at the same position as wall then the ball gets stuck or bounce or does weird things. I believe that it shouldn't has matter where I create the body if there is collision filter. Had anyone similar problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已经很晚了,但我使用屏蔽
http 解决了类似的问题://www.aurelienribon.com/blog/2011/07/box2d-tutorial-collision-filtering/
干杯。
It's pretty late, but I got around a similar problem using masking
http://www.aurelienribon.com/blog/2011/07/box2d-tutorial-collision-filtering/
cheers.
我仍然不知道为什么会出现问题,但我知道如果我创建 boxBody 和 CircleBody 就会发生这种情况。我使用 PolygonBody 而不是 BoxBody 解决了这个问题。这是我的代码,它从多边形体创建盒子。
I still don't know why the problem appears but I know that it happens if I create boxBody and circleBody. I solved this problem using polygonBody instead of boxBody. Here is my code which create box from polygon body.