Answer the question
In order to leave comments, you need to log in
How to detect intersection of two bodies in phaser.js (p2 physics engine)?
Hello!
I'm making a Phaser.js game using the P2 physics engine and I'm having trouble detecting body collision between two sprite bodies. If the player's body intersects with the body of the enemy, then the corresponding callback should be processed. Now I'm checking for the intersection of two sprites, not their bodies:
Phaser.Rectangle.intersects(player.getBounds(), enemy.getBounds())
I wanted to implement this feature through collision groups using the collides method , but then the player will not fly through the enemy and if his body is static (enemy.body.static) then the collides method does not work
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question