p2.js
p2.js copied to clipboard
body on BeginContact hasn't been emitted
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?
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)
that should be world.on('beginContact',function()), and how do you set the sensor proeperty , i can't find that property