Phaser API Documentation

  Version: 
<static> GetLineToPoints(line, points, [isRay], [out])

Description:

Checks for the closest point of intersection between a line segment and an array of points, where each pair of points are converted to line segments for the intersection tests.

If no intersection is found, this function returns null.

If intersection was found, a Vector3 is returned with the following properties:

The x and y components contain the point of the intersection. The z component contains the closest distance.

Parameters:

name type arguments Default description
line Phaser.Geom.Line

The line segment, or ray, to check. If a ray, set the isRay parameter to true.

points Array.<Phaser.Math.Vector2> | Array.<Phaser.Geom.Point>

An array of points to check.

isRay boolean <optional> false

Is line a ray or a line segment?

out Phaser.Math.Vector3 <optional>

A Vector3 to store the intersection results in.

Returns:
Description:

A Vector3 containing the intersection results, or null.

Since: 3.50.0