Cinemachine
![]() | UnityVectorExtensionsClosestPointOnSegment Method (Vector3, Vector3, Vector3) |
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)

public static float ClosestPointOnSegment( this Vector3 p, Vector3 s0, Vector3 s1 )
Cinemachine.Utility.UnityVectorExtensions.ClosestPointOnSegment = function(p, s0, s1);
Parameters
- p
- Type: Vector3
A point in space - s0
- Type: Vector3
Start of line segment - s1
- Type: Vector3
End of line segment
Return Value
Type: SingleThe 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 Vector3. 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).