Jump to content

P2 bodies trigger contact onBeginContact before bodies actually touch


aaronhampton
 Share

Recommended Posts

I'm creating 2 circles using graphics and adding them to sprites. I'm trying to make the sprites contact each other, but the function added on onBeginContact is called before the objects touch. I have a jsfiddle here: http://jsfiddle.net/vL6gkeue/

 

Can anyone please let me know why there is space between the two bodies yet they appear to have made contact? 

Link to comment
Share on other sites

var blobSize = 20;var circObj = new Phaser.Circle(0, 0, blobSize);blob.body.setCircle(blobSize);

It may be that Phaser.Circle takes a diameter, but body.setCircle takes a radius.

 

 

I've tried reducing the size used when calling setCircle significantly, but the collisions still occur before the bodies touch. Debug is enabled on both bodies in the jsfiddle and you can see their sizes are the same as the circles that have been drawn. I'm sure I'm missing something, but I just don't know what it would be.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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