Physics.Arcade#angleToXY()

angleToXY(displayObject, x, y, world) → {number}

Find the angle in radians between a display object (like a Sprite) and the given x/y coordinate.

The optional world argument allows you to return the result based on the Game Objects world property,
instead of its x and y values. This is useful of the object has been nested inside an offset Group,
or parent Game Object.

Parameters
Name Type Argument Default Description
displayObject any

The Display Object to test from.

x number

The x coordinate to get the angle to.

y number

The y coordinate to get the angle to.

world boolean <optional>
false

Calculate the angle using World coordinates (true), or Object coordinates (false, the default)

Returns
number -

The angle in radians between displayObject.x/y to Pointer.x/y

Source code: physics/arcade/World.js (Line 2041)
doc_phaser
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.