简体   繁体   English

在Box2D中检测碰撞而不是联系人

[英]Detect a Collision, not a Contact in Box2D

First, let me define how I perceive these two concepts: 首先,让我定义一下我如何看待这两个概念:

Collision happens when Object A collides/bumps/runs into Object B . 对象A 碰撞/点/运行到 对象B发生碰撞 As in they come into contact with each other, but with a high velocity. 如同它们彼此接触,但是速度很高。

Contact happens when Object A touches Object B . 联系发生在对象A 触摸 对象B。 As in they come into contact with [very] low velocity. 因为它们以[非常]低的速度接触。 As in they just touch. 正如他们只是触摸。

In Box2D , we assign ContactListener s to the PhysicsSystem in order to detect a contact. Box2D中 ,我们将ContactListener分配给PhysicsSystem以便检测联系人。 My question is, how do we detect a collision ? 我的问题是, 我们如何检测到碰撞

I'm using AndEngine in my project. 我在我的项目中使用AndEngine

您可以在接触侦听器的BeginContact函数中检查两个物体的相对速度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM