Physics.Arcade#angleToPointer()

angleToPointer(displayObject, pointer, world) → {number}

Find the angle in radians between a display object (like a Sprite) and a Pointer, taking their x/y and center into account.

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.

pointer Phaser.Pointer <optional>

The Phaser.Pointer to test to. If none is given then Input.activePointer is used.

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 2070)
doc_phaser
2017-02-14 10:58:52
Comments
Leave a Comment

Please login to continue.