在花栗鼠物理中从关节中移除物体
在 Box2D 中,当连接到关节的主体从空间中移除时,关节会自动删除,您可以在回调等中执行操作。
花栗鼠会这样做吗?如果是这样,我如何检测联合连接何时“断开”?我必须手动跟踪这些东西吗?
In Box2D, when a body that is connected to a joint is removed from the space, the joint is automatically deleted and you can do stuff in callbacks and so on.
Does Chipmunk do this? If so, how can I detect when a joint connection is 'broken'? Do I have to keep track of this stuff manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你所说的检测关节何时断裂是什么意思。我不相信花栗鼠会在模拟过程中弄断关节。如果由于尸体被毁而导致关节断裂,清理时要小心。来自 Chipmunk 的文档页面:
使用 cpSpaceRemoveConstraint 它将把它从两个物体上移除。然后使用 cpConstraintFree 释放约束内存。
I'm not sure what you mean by detecting when a joint is broken. I don't believe Chipmunk breaks joints as part of the simulation. If the joint is broken because a body has been destroyed be careful on cleanup. From the documentation page for Chipmunk:
Use cpSpaceRemoveConstraint and it will remove it from both bodies. Then free the constraint memory using cpConstraintFree.