distanceToPointer(displayObject, pointer, world) → {number}
Find the distance between a display object (like a Sprite) and a Pointer. If no Pointer is given the Input.activePointer is used.
The calculation is made from the display objects x/y coordinate. This may be the top-left if its anchor hasn't been changed.
If you need to calculate from the center of a display object instead use the method distanceBetweenCenters()
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 distance using World coordinates (true), or Object coordinates (false, the default)  |  
Returns
The distance between the object and the Pointer.
- Source code: physics/arcade/World.js (Line 1969)
 
Please login to continue.