在 Box2d、AndEngine 中,快速移动的物体有时会错过碰撞
我有一个动态的快速移动身体(A)。它应该与另一个物体(B)碰撞。 A 与 B 发生碰撞,但有时它会经过 Body B 而不会发生碰撞。这完全是随机行为。我一定会遇到那种碰撞。请指导为什么它会随机出现这样的行为。
I have a Fast Moving Body(A) which is dynamic. It is supposed to collide with another Body(B). A collides with B, but sometimes it passes the Body B without collision. This is totally random behavior. I must have that collision. Kindly guide why it is acting like this, randomly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于单个时间步长内的较大运动而导致一个对象穿过另一个对象的效应称为隧道效应。
Box2D 在动态和静态对象之间使用连续碰撞检测来解决此问题。但是,您的情况(动态与动态)不会自动处理,因此您的对象在评估碰撞时是否恰好处于碰撞位置只是随机掷骰子。
来自 Box2d 手册:
The effect of one object passing through another due to large movement in a single timestep is called tunneling.
Box2D uses Continuous Collision Detection between dynamic and static objects to solve this problem. However, your case (dynamic v.s. dynamic) isn't automatically handled, so it's just a random dice throw whether your objects happen to be in colliding positions at the exact moment the collisions are evaluated.
From the Box2d Manual: