Class Plane
Plane metatype, wrapper for godot_plane
.
Constructed using the idiom Plane(...)
, which calls __new.
The components may be accessed through elements
or individually as
normal/d
:
typedef union godot_plane {
float elements[4];
struct { Vector3 normal; float d; };
} godot_plane;
Methods
Plane:center () | Returns the center of the plane. |
Plane:distance_to (point) | Returns the shortest distance from the plane to the position point . |
Plane:has_point (point[, epsilon=1e-5]) | Returns true if point is inside the plane. |
Plane:intersect_3 (b, c) | Returns the intersection point of the three planes b , c and this plane. |
Plane:intersects_ray (from, dir) | Returns the intersection point of a ray consisting of the position from and the direction normal dir with this plane. |
Plane:intersects_segment (begin, end) | Returns the intersection point of a segment from position begin to position end with this plane. |
Plane:is_point_over (point) | Returns true if point is located above the plane. |
Plane:normalized () | Returns a copy of the plane, normalized. |
Plane:project (point) | Returns the orthogonal projection of point into a point in the plane. |
Plane:unpack () | Returns all elements. |
Metamethods
Plane:__concat (a, b) | Concatenates values. |
Plane:__eq (a, b) | Equality operation
If either a or b are not of type Plane, always return false . |
Plane:__new (...) | Plane constructor, called by the idiom Plane(...) . |
Plane:__tostring () | Returns a Lua string representation of this plane. |
Plane:__unm () | Unary minus operation |
Constants
Plane.XY | A plane that extends in the X and Y axes (normal vector points +Z). |
Plane.XZ | A plane that extends in the X and Z axes (normal vector points +Y). |
Plane.YZ | A plane that extends in the Y and Z axes (normal vector points +X). |
Methods
- Plane:center ()
-
Returns the center of the plane.
Returns:
- Plane:distance_to (point)
-
Returns the shortest distance from the plane to the position
point
.Parameters:
- point Vector3
Returns:
-
number
- Plane:has_point (point[, epsilon=1e-5])
-
Returns
true
ifpoint
is inside the plane. Comparison uses a custom minimumepsilon
threshold.Parameters:
- point Vector3
- epsilon number (default 1e-5)
Returns:
-
bool
- Plane:intersect_3 (b, c)
-
Returns the intersection point of the three planes
b
,c
and this plane.Parameters:
Returns:
-
Vector3
Intersection point, if there is any
Or
-
nil
If no intersection is found
- Plane:intersects_ray (from, dir)
-
Returns the intersection point of a ray consisting of the position
from
and the direction normaldir
with this plane.Parameters:
Returns:
-
Vector3
Intersection point, if there is any
Or
-
nil
If no intersection is found
- Plane:intersects_segment (begin, end)
-
Returns the intersection point of a segment from position
begin
to positionend
with this plane.Parameters:
Returns:
-
Vector3
Intersection point, if there is any
Or
-
nil
If no intersection is found
- Plane:is_point_over (point)
-
Returns
true
ifpoint
is located above the plane.Parameters:
- point Vector2
Returns:
-
bool
- Plane:normalized ()
-
Returns a copy of the plane, normalized.
Returns:
- Plane:project (point)
-
Returns the orthogonal projection of
point
into a point in the plane.Parameters:
- point Vector3
Returns:
- Plane:unpack ()
-
Returns all elements.
Returns:
- number normal.x
- number normal.y
- number normal.z
- number d
Metamethods
- Plane:__concat (a, b)
-
Concatenates values.
Parameters:
Returns:
- Plane:__eq (a, b)
-
Equality operation
If either
a
orb
are not of type Plane, always returnfalse
.Parameters:
Returns:
-
bool
- Plane:__new (...)
-
Plane constructor, called by the idiom
Plane(...)
.Plane(Vector3 normal, number d)
: set the normal and the plane's distance to the originPlane(number a, number b, number c, number d)
: normal is set toVector3(a, b, c)
, distance is set tod
Plane(Vector3 a, Vector3 b, Vector3 c)
: creates a plane from the three points, given in clockwise orderPlane(Plane other)
: copy values fromother
Parameters:
- ...
Returns:
- Plane:__tostring ()
-
Returns a Lua string representation of this plane.
Returns:
- Plane:__unm ()
-
Unary minus operation
Returns: