Finds the Body or Game Object closest to a source point or object.
If a targets
argument is passed, this method finds the closest 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 closest Dynamic Body.
If two or more targets are the exact same distance from the source point, only the first target is returned.
name | type | arguments | description |
---|---|---|---|
source | any |
Any object with public |
|
targets | Array.<Phaser.Physics.Arcade.Body> | Array.<Phaser.Physics.Arcade.StaticBody> | Array.<Phaser.GameObjects.GameObject> | <optional> |
The targets. |
The target closest to the given source point.