Checks for the closest point of intersection between a line segment and an array of polygons.
If no intersection is found, this function returns null
.
If intersection was found, a Vector4 is returned with the following properties:
The x
and y
components contain the point of the intersection.
The z
component contains the closest distance.
The w
component contains the index of the polygon, in the given array, that triggered the intersection.
name | type | arguments | Default | description |
---|---|---|---|---|
line | Phaser.Geom.Line |
The line segment, or ray, to check. If a ray, set the |
||
polygons | Phaser.Geom.Polygon | Array.<Phaser.Geom.Polygon> |
A single polygon, or array of polygons, to check. |
||
isRay | boolean | <optional> | false |
Is |
out | Phaser.Math.Vector4 | <optional> |
A Vector4 to store the intersection results in. |
A Vector4 containing the intersection results, or null
.