UnityVectorExtensions.ClosestPointOnSegment Method (Vector2, Vector2, Vector2)

Cinemachine

UnityVectorExtensionsClosestPointOnSegment Method (Vector2, Vector2, Vector2)

Get the closest point on a line segment.

Namespace:  Cinemachine.Utility
Assembly:  Cinemachine (in Cinemachine.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
public static float ClosestPointOnSegment(
	this Vector2 p,
	Vector2 s0,
	Vector2 s1
)
Cinemachine.Utility.UnityVectorExtensions.ClosestPointOnSegment = function(p, s0, s1);

Parameters

p
Type: Vector2
A point in space
s0
Type: Vector2
Start of line segment
s1
Type: Vector2
End of line segment

Return Value

Type: Single
The interpolation parameter representing the point on the segment, with 0==s0, and 1==s1

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector2. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also