Phaser API Documentation

  Version: 
furthest(source, [targets])

Description:

Finds the Body or Game Object farthest from a source point or object.

If a targets argument is passed, this method finds the farthest of those. The targets can be Arcade Physics Game Objects, Dynamic Bodies, or Static Bodies.

If no targets argument is passed, this method finds the farthest Dynamic Body.

If two or more targets are the exact same distance from the source point, only the first target is returned.

Parameters:

name type arguments description
source any

Any object with public x and y properties, such as a Game Object or Geometry object.

targets Array.<Phaser.Physics.Arcade.Body> | Array.<Phaser.Physics.Arcade.StaticBody> | Array.<Phaser.GameObjects.GameObject> <optional>

The targets.

Returns:
Description:

The target farthest from the given source point.

Since: 3.0.0