Closed guawoo closed 6 years ago
Check this part of the Demo code.
i use this function to detect collisions and spawn some particles at that point.
function findContacts(){
for(let i = 0; i < world.narrowphase.contactEquations.length; i++){
let eq = world.narrowphase.contactEquations[i]
let bodyAPosition = eq.bodyA.position
let contactPointA = eq.contactPointA
let contactX = bodyAPosition[0] + contactPointA[0]
let contactY = bodyAPosition[1] + contactPointA[1]
spawnParticle(contactX, contactY)
}
}
oh, that great! thank you so mush. :)
I can not found a demo about to get contact points when bodies collided. I only found a topic about this was a phaser approach, but my project is not phaser :(.