Phaser API Documentation

getTopLeft(body, [x], [y])


Takes a Body and returns the world coordinates of the top-left of its bounds.

Body bounds are updated by Matter each step and factor in scale and rotation. This will return the world coordinate based on the bodies current position and bounds.


name type arguments description
body Phaser.Types.Physics.Matter.MatterBody

The Body to get the position from.

x number <optional>

Optional horizontal offset to add to the returned coordinates.

y number <optional>

Optional vertical offset to add to the returned coordinates.


A Vector2 containing the coordinates, or false if it was unable to parse the body.

Since: 3.22.0