Api Line
struct

Line

public sealed struct Line

Represents a line in 3D space.

Constructors

Line(Vector3 a, Vector3 b)
Line(Vector3 origin, Vector3 direction, Single length)

Properties

Name Type Description
Start Vector3 Start position of the line.
End Vector3 End position of the line.
Delta Vector3 Returns the result of b - a
Center Vector3 Returns the midpoint between a and b

Methods

Boolean Trace(Ray ray, Single radius, Single maxDistance = 3.4028235E+38)

Perform a "trace" between this line and given ray. If the 2 lines intersect, returns true.

ray — The ray to test against.
radius — Radius of this line, which essentially makes this a capsule, since direct line-to-line intersections are very improbable. Must be above 0.
maxDistance — Maximum allowed distance from the origin of the ray to the intersection.
returns — Whether there was an intersection or not.
Vector3 ClosestPoint(Vector3 pos)

Returns closest point on this line to the given point.

Boolean ClosestPoint(Ray ray, Vector3 point_on_line)

Returns closest point on this line to the given ray.

Boolean ClosestPoint(Ray ray, Vector3 point_on_line, Vector3 point_on_ray)

Returns closest point on this line to the given ray.

Single Distance(Vector3 pos)

Returns closest distance from this line to given point.

Single Distance(Vector3 pos, Vector3 closestPoint)

Returns closest distance from this line to given point.

Single SqrDistance(Vector3 pos)

Returns closest squared distance from this line to given point.

Assembly: Sandbox.System Full Name: Line