Jump to content

Detect collision force and location


MaximeC
 Share

Recommended Posts

I am using onBeginContact in order to get the body that collided with the player's body (using p2):

hitWall: function(wall, shapeWall, shapeShip, equation) {...}

However, I don't know how to :

- compute the « force » of the collision. I am currently using the speed of the player's body but I'm not sure that's a good idea (need confirmation). And the values are different between different phaser versions.

- detect the part of the player's body that collided with something. Basically, if it's the bottom of the body it's fine, otherwise I need to remove life in function of the impact force.

 

I didn't find documentation on the ContactEquation and I don't understand how to retrieve relevant data from the shapes. The other object is a wall from a tilemap.

 

Thanks.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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