Phaser API Documentation

  Version: 
<static> GetLineToLine(line1, line2, [isRay], [out])

Description:

Checks for intersection between the two line segments, or a ray and a line segment, and returns the intersection point as a Vector3, or null if the lines are parallel, or do not intersect.

The z property of the Vector3 contains the intersection distance, which can be used to find the closest intersecting point from a group of line segments.

Parameters:

name type arguments Default description
line1 Phaser.Geom.Line

The first line segment, or a ray, to check.

line2 Phaser.Geom.Line

The second line segment to check.

isRay boolean <optional> false

Is line1 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