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:

    Vector3
Plane:distance_to (point)
Returns the shortest distance from the plane to the position point.

Parameters:

Returns:

    number
Plane:has_point (point[, epsilon=1e-5])
Returns true if point is inside the plane. Comparison uses a custom minimum epsilon 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 normal dir 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 position end 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 if point is located above the plane.

Parameters:

Returns:

    bool
Plane:normalized ()
Returns a copy of the plane, normalized.

Returns:

    Plane
Plane:project (point)
Returns the orthogonal projection of point into a point in the plane.

Parameters:

Returns:

    Vector3
Plane:unpack ()
Returns all elements.

Returns:

  1. number normal.x
  2. number normal.y
  3. number normal.z
  4. number d

Metamethods

Plane:__concat (a, b)
Concatenates values.

Parameters:

  • a First value, stringified with GD.str
  • b First value, stringified with GD.str

Returns:

    String
Plane:__eq (a, b)
Equality operation If either a or b are not of type Plane, always return false.

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 origin
  • Plane(number a, number b, number c, number d): normal is set to Vector3(a, b, c), distance is set to d
  • Plane(Vector3 a, Vector3 b, Vector3 c): creates a plane from the three points, given in clockwise order
  • Plane(Plane other): copy values from other

Parameters:

  • ...

Returns:

    Plane
Plane:__tostring ()
Returns a Lua string representation of this plane.

Returns:

    string
Plane:__unm ()
Unary minus operation

Returns:

    Plane

Constants

Plane.XY
A plane that extends in the X and Y axes (normal vector points +Z).
  • XY Plane(0, 0, 1, 0)
Plane.XZ
A plane that extends in the X and Z axes (normal vector points +Y).
  • XZ Plane(0, 1, 0, 0)
Plane.YZ
A plane that extends in the Y and Z axes (normal vector points +X).
  • YZ Plane(1, 0, 0, 0)
generated by LDoc 1.4.6 Last updated 2023-01-04 08:52:34