Class PlaneGodotExtensions

Namespace
Elegy.Common.Extensions
Assembly
Elegy.Common.dll

Plane extensions from Godot's own Plane class. Lots of useful gamedev-specific stuff there.

public static class PlaneGodotExtensions
Inheritance
PlaneGodotExtensions
Inherited Members

Methods

DistanceTo(Plane, Vector3)

Returns the shortest distance from this plane to the position point.

public static float DistanceTo(this Plane p, Vector3 point)

Parameters

p Plane
point Vector3

The position to use for the calculation.

Returns

float

The shortest distance.

GetCenter(Plane)

Returns the center of the plane, the point on the plane closest to the origin. The point where the normal line going through the origin intersects the plane.

public static Vector3 GetCenter(this Plane p)

Parameters

p Plane

Returns

Vector3

Equivalent to Normal multiplied by D.

HasPoint(Plane, Vector3, float)

Returns true if point is inside the plane. Comparison uses a custom minimum tolerance threshold.

public static bool HasPoint(this Plane p, Vector3 point, float tolerance = 1E-45)

Parameters

p Plane
point Vector3

The point to check.

tolerance float

The tolerance threshold.

Returns

bool

A bool for whether or not the plane has the point.

Intersect3(Plane, Plane, Plane)

Returns the intersection point of the three planes: b, c, and this plane. If no intersection is found, null is returned.

public static Vector3? Intersect3(this Plane p, Plane b, Plane c)

Parameters

p Plane
b Plane

One of the three planes to use in the calculation.

c Plane

One of the three planes to use in the calculation.

Returns

Vector3?

The intersection, or null if none is found.

IntersectsRay(Plane, Vector3, Vector3)

Returns the intersection point of a ray consisting of the position from and the direction normal dir with this plane. If no intersection is found, null is returned.

public static Vector3? IntersectsRay(this Plane p, Vector3 from, Vector3 dir)

Parameters

p Plane
from Vector3

The start of the ray.

dir Vector3

The direction of the ray, normalized.

Returns

Vector3?

The intersection, or null if none is found.

IntersectsSegment(Plane, Vector3, Vector3)

Returns the intersection point of a line segment from position begin to position end with this plane. If no intersection is found, null is returned.

public static Vector3? IntersectsSegment(this Plane p, Vector3 begin, Vector3 end)

Parameters

p Plane
begin Vector3

The start of the line segment.

end Vector3

The end of the line segment.

Returns

Vector3?

The intersection, or null if none is found.

IsFinite(Plane)

Returns true if this plane is finite, by calling IsFinite(float) on each component.

public static bool IsFinite(this Plane p)

Parameters

p Plane

Returns

bool

Whether this vector is finite or not.

IsPointOver(Plane, Vector3)

Returns true if point is located above the plane.

public static bool IsPointOver(this Plane p, Vector3 point)

Parameters

p Plane
point Vector3

The point to check.

Returns

bool

A bool for whether or not the point is above the plane.

Normalized(Plane)

Returns the plane scaled to unit length.

public static Plane Normalized(this Plane p)

Parameters

p Plane

Returns

Plane

A normalized version of the plane.

Project(Plane, Vector3)

Returns the orthogonal projection of point into the plane.

public static Vector3 Project(this Plane p, Vector3 point)

Parameters

p Plane
point Vector3

The point to project.

Returns

Vector3

The projected point.