Jump to content

[P2] Collision detection without impact


Recommended Posts

Hello everyone,


I would like to detect a collision between a powerup and a player, both are P2JS bodies.


My problem is really simple : I don't want the player to physically "hit" the powerup and get slowed down

Both bodyCallbacks and onBeginContact() have this issue, even if I remove the powerup immediately after the contact (which makes sense according to the docs that says it's fired after the step so the collision already happened)


Is there a simple way to avoid that and just detect the intersection between the bodies ?


Thank you in advance!




Link to comment
Share on other sites

Is the powerup moving? If its Static you could define it as sensor.. Not colliding anymore but still sensing and calling onbegincontact

Another way would be to use the onpresolve event and check if the player will collide with the power up and remove it before he does.

In my first try to learn phaser I had powerups that collided and the removing on collision worked quite well


Link to comment
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.

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.


  • Recently Browsing   0 members

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