Class AABB

AABB metatype, wrapper for godot_aabb.

Constructed using the idiom AABB(...), which calls __new.

typedef union godot_aabb {
    uint8_t data[24];
    float elements[6];
    struct { Vector3 position, size; };
} godot_aabb;

Methods

AABB:encloses (with) Returns true if this AABB completely encloses another one.
AABB:expand (point) Returns this AABB expanded to include a given point.
AABB:get_area () Returns the volume of the AABB.
AABB:get_endpoint (index) Gets the position of the 8 endpoints of the AABB in space.
AABB:get_longest_axis () Returns the normalized longest axis of the AABB.
AABB:get_longest_axis_index () Returns the index of the longest axis of the AABB (according to Vector3's AXIS_* constants).
AABB:get_longest_axis_size () Returns the scalar length of the longest axis of the AABB.
AABB:get_shortest_axis () Returns the normalized shortest axis of the AABB.
AABB:get_shortest_axis_index () Returns the index of the shortest axis of the AABB (according to Vector3's AXIS_* constants).
AABB:get_shortest_axis_size () Returns the scalar length of the shortest axis of the AABB.
AABB:get_support (direction) Returns the support point in a given direction.
AABB:grow (by) Returns a copy of the AABB grown a given amount of units towards all the sides.
AABB:has_no_area () Returns true if the AABB is flat or empty.
AABB:has_no_surface () Returns true if the AABB is empty.
AABB:has_point (point) Returns true if the AABB contains a point.
AABB:intersection (with) Returns the intersection between two AABB.
AABB:intersects (with) Returns true if the AABB overlaps with another.
AABB:intersects_plane (plane) Returns true if the AABB is on both sides of a plane.
AABB:intersects_segment (from, to) Returns true if the AABB intersects the line segment between from and to.
AABB:merge (with) Returns a larger AABB that contains both this AABB and with.

Metamethods

AABB:__concat (a, b) Concatenates values.
AABB:__eq (a, b) Equality operation If either a or b are not of type AABB, always return false.
AABB:__new (...) AABB constructor, called by the idiom AABB(...).
AABB:__tostring () Returns a Lua string representation of this AABB.


Methods

AABB:encloses (with)
Returns true if this AABB completely encloses another one.

Parameters:

Returns:

    bool
AABB:expand (point)
Returns this AABB expanded to include a given point.

Parameters:

Returns:

    AABB
AABB:get_area ()
Returns the volume of the AABB.

Returns:

    number
AABB:get_endpoint (index)
Gets the position of the 8 endpoints of the AABB in space.

Parameters:

  • index int

Returns:

    Vector3
AABB:get_longest_axis ()
Returns the normalized longest axis of the AABB.

Returns:

    Vector3
AABB:get_longest_axis_index ()
Returns the index of the longest axis of the AABB (according to Vector3's AXIS_* constants).

Returns:

    int
AABB:get_longest_axis_size ()
Returns the scalar length of the longest axis of the AABB.

Returns:

    number
AABB:get_shortest_axis ()
Returns the normalized shortest axis of the AABB.

Returns:

    Vector3
AABB:get_shortest_axis_index ()
Returns the index of the shortest axis of the AABB (according to Vector3's AXIS_* constants).

Returns:

    int
AABB:get_shortest_axis_size ()
Returns the scalar length of the shortest axis of the AABB.

Returns:

    number
AABB:get_support (direction)
Returns the support point in a given direction. This is useful for collision detection algorithms.

Parameters:

Returns:

    Vector3
AABB:grow (by)
Returns a copy of the AABB grown a given amount of units towards all the sides.

Parameters:

  • by number

Returns:

    AABB
AABB:has_no_area ()
Returns true if the AABB is flat or empty.

Returns:

    bool
AABB:has_no_surface ()
Returns true if the AABB is empty.

Returns:

    bool
AABB:has_point (point)
Returns true if the AABB contains a point.

Parameters:

Returns:

    bool
AABB:intersection (with)
Returns the intersection between two AABB. An empty AABB (size 0,0,0) is returned on failure.

Parameters:

Returns:

    AABB
AABB:intersects (with)
Returns true if the AABB overlaps with another.

Parameters:

Returns:

    bool
AABB:intersects_plane (plane)
Returns true if the AABB is on both sides of a plane.

Parameters:

Returns:

    bool
AABB:intersects_segment (from, to)
Returns true if the AABB intersects the line segment between from and to.

Parameters:

Returns:

    bool
AABB:merge (with)
Returns a larger AABB that contains both this AABB and with.

Parameters:

Returns:

    AABB

Metamethods

AABB:__concat (a, b)
Concatenates values.

Parameters:

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

Returns:

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

Parameters:

Returns:

    bool
AABB:__new (...)

AABB constructor, called by the idiom AABB(...).

  • AABB(): all zeros (AABB() == AABB(Vector3.ZERO, Vector3.ZERO))
  • AABB(Vector3 position, Vector3 size): set position and size
  • AABB(AABB other): copy values from other

Parameters:

  • ...

Returns:

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

Returns:

    string
generated by LDoc 1.4.6 Last updated 2023-01-04 08:52:34