Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IntersectLineSegments(Vector2, Vector2, Vector2, Vector2)

Finds the intersection between two line segments
Read time 1 minuteLast updated 10 days ago

Definition

public static Vector2 IntersectLineSegments(Vector2 line1Pt1, Vector2 line1Pt2, Vector2 line2Pt1, Vector2 line2Pt2)

Parameters

line1Pt1

The first point of the first line

line1Pt2

The second point of the first line

line2Pt1

The first point of the second line

line2Pt2

The second point of the second line

Returns

Type

Description

Vector2The intersection point, or (float.PositiveInfinity, float.PositiveInfinity) if the lines are parallel