Api Sandbox Plane
struct

Plane

public sealed struct Plane

Represents a plane.

Constructors

Plane(Vector3 normal, Single dist)
Plane(Vector3 origin, Vector3 normal)
Plane(Vector3 origin, Vector3 posA, Vector3 posB)

Creates a new plane from 3 given positions.

origin — Origin of the plane.
posA — A position to calculate a normal with.
posB — Another position to calculate a normal with.

Properties

Name Type Description
Origin Vector3 Origin position of the plane, basically a vector Distance away from world origin in the direction given by Normal.
Position Vector3 Origin position of the plane, basically a vector Distance away from world origin in the direction given by Normal.

Methods

Single GetDistance(Vector3 point)

Returns the distance from this plane to given point.

Boolean IsInFront(Vector3 point)

Returns true if given point is on the side of the plane where its normal is pointing.

Boolean IsInFront(BBox box, Boolean partially = False)

Returns true if given bounding box is on the side of the plane where its normal is pointing.

Vector3 SnapToPlane(Vector3 point)

Returns closest point on the plane to given point.

Boolean TryTrace(Ray ray, Vector3 hitPoint, Boolean twosided = False, Double maxDistance = 1.7976931348623157E+308)

Trace a Ray against this plane

Vector3? Trace(Ray ray, Boolean twosided = False, Double maxDistance = 1.7976931348623157E+308)

Trace a Ray against this plane

ray — The origin and direction to trace from
twosided — If true we'll trace against the underside of the plane too.
maxDistance — The maximum distance from the ray origin to trace
returns — The hit position on the ray. Or null if we didn't hit.
static Vector3? GetIntersection(Plane vp1, Plane vp2, Plane vp3)

Gets the intersecting point of the three planes if it exists. If the planes don't all intersect will return null.

Vector3? IntersectLine(Line line)

Gets the intersecting point of a line segment.

Vector3? IntersectLine(Vector3 start, Vector3 end)

Gets the intersecting point of a line segment.

Vector3 ReflectPoint(Vector3 point)

Reflects a point across the plane.

Vector3 ReflectDirection(Vector3 direction)

Reflects a direction across the plane.

Fields

Name Type Description
Normal Vector3 The direction of the plane.
Distance Single Distance of the plane from world origin in the direction given by Normal.
Assembly: Sandbox.System Namespace: Sandbox Full Name: Sandbox.Plane