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
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
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
Returns
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
Planeb
PlaneOne of the three planes to use in the calculation.
c
PlaneOne of the three planes to use in the calculation.
Returns
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
Returns
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
Returns
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
Returns
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
Returns
- Vector3
The projected point.