Jump to content

Phaser + P2 + Dynamic Bodies


Recommended Posts



I've been mucking around with this problem for several days, attempting all types of odd solutions and nothing I can come up with works. 

My problem is this, I spawn a Player object, a sprite with P2 enabled on it. I spawn another Player Object, a sprite with P2 enabled on it.

I need both objects to move freely and collide with the world and one another... which they currently do perfectly fine.


The issue is when the player objects collide with one another, one always moves the other. I don't wish for either to move the other. Does anyone know of a solution to this using P2? 

Here's the 'gotcha' .. I need both Player bodies to stay dynamic so they collide with the world objects, and setting them to static or kinematic makes them run through everything which is what I tried. Setting the mass of one to zero or Number.MAX_NUMBER does not work as the game is multiplayer and the server needs to run and have the exact same physics response as the clients, which it doesn't once I do that on the client’s machine. The server doesn't encounter the same order of collision and one player object might become the one with the super mass and run through the other which is not good!


Thank you for your time!


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...