aaronhampton Posted October 27, 2014 Share Posted October 27, 2014 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 More sharing options...
aaronhampton Posted October 27, 2014 Author Share Posted October 27, 2014 I forgot to add. To shoot the blob at the bottom toward the circle, press the spacebar. Link to comment Share on other sites More sharing options...
pixelpathos Posted October 27, 2014 Share Posted October 27, 2014 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. Link to comment Share on other sites More sharing options...
aaronhampton Posted October 27, 2014 Author Share Posted October 27, 2014 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 More sharing options...
aaronhampton Posted October 28, 2014 Author Share Posted October 28, 2014 I've updated the jsfiddle to use the radius of the circles I'm drawing here: http://jsfiddle.net/ogo5d4ax/ That seems to work better, but I'm still confused as to why the body shown is smaller than the circles drawn and why those bodies are colliding without actually touching. Link to comment Share on other sites More sharing options...
Recommended Posts