Phaser API Documentation

intersectPoint(x, y, [bodies])


Checks the given coordinates to see if any vertices of the given bodies contain it.

If no bodies are provided it will search all bodies in the Matter World, including within Composites.

The coordinates should be transformed into the Matter World coordinate system in advance. This happens by default with Input Pointers, but if you wish to use coordinates from another system you may need to transform them before passing them.


name type arguments description
x number

The horizontal coordinate of the point.

y number

The vertical coordinate of the point.

bodies Array.<Phaser.Types.Physics.Matter.MatterBody> <optional>

An array of bodies to check. If not provided it will search all bodies in the world.


An array of bodies which contain the given point.

Since: 3.22.0