Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IntersectsSegment(Rect, Vector2, Vector2)

Check if a line segment overlaps a rectangle.
Read time 1 minuteLast updated 6 days ago

Definition

public static bool IntersectsSegment(Rect rect, Vector2 p1, Vector2 p2)

Parameters

rect

Rectangle to check.

Line segment point 1.

Line segment point 2.

Returns

Type

Description

boolTrue if line segment overlaps rectangle. False otherwise.