Garry's Mod Wiki

util.DistanceToLine

  number, Vector, number util.DistanceToLine( Vector lineStart, Vector lineEnd, Vector pointPos )

Description

Gets the distance between a line and a point in 3d space.

Arguments

1 Vector lineStart
Start of the line.
2 Vector lineEnd
End of the line.
3 Vector pointPos
The position of the point.

Returns

1 number
Distance from line.
2 Vector
Nearest point on line.
3 number
Distance along line from start.