akesterson Posted July 5, 2014 Share Posted July 5, 2014 I'm not sure if this is a bug or I'm just misunderstanding how arcade collision is supposed to work. I have 2 sprites, 'this' and 'player'. Both have enabled arcade physics bodies. Consider their properties:> this.body.positionPhaser.Point {x: 640, y: 224.08333333333334, copyFrom: function, invert: function, setTo: function…}> this.body.width32> this.body.height32> player.body.positionPhaser.Point {x: 645.3119999999997, y: 234.6879999999998, copyFrom: function, invert: function, setTo: function…}> player.body.width16> player.body.height16In this instance we would expect them to overlap. This is true:> game.physics.arcade.overlap(this, player)true.. Given that the 2 physics bodies are overlapping, I would also expect them to be colliding. This is not true:> game.physics.arcade.collide(this, player)falseNeither of the physics bodies have the immovable flag set (though, for what it's worth, setting that flag doesn't change anything). What am I doing wrong here? Link to comment Share on other sites More sharing options...
markergreen Posted August 21, 2015 Share Posted August 21, 2015 What you've discovered is correct, collision detection makes sure that the 2 physics bodies never overlap. Link to comment Share on other sites More sharing options...
Overkitty Posted August 21, 2015 Share Posted August 21, 2015 How are the sprites being moved? In order for collide to work one or both sprites has to be moving. Link to comment Share on other sites More sharing options...
Recommended Posts