Jump to content

Detect collision force and location


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...