p2.js icon indicating copy to clipboard operation
p2.js copied to clipboard

body on BeginContact hasn't been emitted

Open jimmyyao88 opened this issue 7 years ago • 2 comments

I have 2 Kinematic body ,and also set the sensor property = true, while they contact each other , the body.on('beginContact',function()) hasn't been emitted ,why?

jimmyyao88 avatar May 10 '17 10:05 jimmyyao88

It looks like beginContact event is not triggered when 2 static or kinematic bodies overlaps. Look at Broadphase.canCollide function http://schteppe.github.io/p2.js/docs/files/src_collision_Broadphase.js.html#l118 This line says it all: if(bodyA.type === KINEMATIC && bodyB.type === KINEMATIC){ return false; } The simplest method I found to check if these 2 bodies overlaps is to run this function every frame world.narrowphase.bodiesOverlap(bodyA, bodyB)

ghost avatar Jun 12 '17 09:06 ghost

that should be world.on('beginContact',function()), and how do you set the sensor proeperty , i can't find that property

jindingping avatar Aug 31 '18 02:08 jindingping