BlueLemming Posted June 26, 2019 Share Posted June 26, 2019 Is there a way to check if a physics sprite would collide with another object at a given position? I have tried something like this: // desired position to check player collision at const checkPosition = { x: 100, y: 100 } // temporarily change player position const pos = { x: player.x, y: player.y } player.setPosition(checkPosition.x, checkPosition.y) // test collision const collision = this.scene.physics.collide(player, otherObj) // set back to original position player.setPosition(pos.x, pos.y) however, I can't get the collision to return true. I suspect there needs to be an update cycle between updating the position and testing for collisions, but I can't find any documentation to suggest that is the case. Is there a good way to go about this? Link to comment Share on other sites More sharing options...
Recommended Posts