几个球在一个有限的正方形内并且不会互相碰撞

发布于 2025-01-01 23:13:47 字数 190 浏览 4 评论 0原文

使用box2d,我想将一些球放在一个有限的正方形中。它们不会与其他球碰撞,但在碰到边缘时会回来。我应该赋予球和正方形什么属性?

如果我设置边缘为b2_dynamicbody,球为b2_kinematicbody,球不会碰撞,但它们只是往那里走,与边缘没有反应(边缘随着球移开-_-“)。相反,球会碰撞我希望有某种方法可以忽略球的碰撞但与边缘做出反应。

With box2d,I want to put some balls in a limited square.They will not collide with other balls but will come back when hit the edge.What properties should I give to the balls and square?

If I set the edge is b2_dynamicbody and ball is b2_kinematicbody,balls don't collide but they just go there way and no reaction with the edge(the edge moved away with the balls -_-").To the contrary,balls will collide each other.I hope there is some way to ignore balls' collide but react with the edge.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぇ气 2025-01-08 23:13:47

这就是安德鲁在上面的评论中回答的答案。我复制了它,让其他遇到同样问题的人看到它已经解决了。非常感谢安德鲁(http://stackoverflow.com/users/444088/andrew)

'看看b2Filter b2Fixture 的属性。 box2d手册中有详细的解释。

另外,这是box2d官方手册的链接
http://www.box2d.org/manual.html

That's the answer which Andrew answered in comment above.I copied it and let others who meets the same problem see it's solved.Best thanks to Andrew(http://stackoverflow.com/users/444088/andrew)

'take a look at b2Filter property of b2Fixture. There is a detailed explanation of it in box2d manual.'

Additional,here is the link to box2d official manual
http://www.box2d.org/manual.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文