Jump to content

Arcade Physics - overlap() returns true when collide() returns false?


akesterson
 Share

Recommended Posts

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.height16

In 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)false

Neither 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

  • 1 year later...
 Share

  • Recently Browsing   0 members

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