Axis-Aligned Bounding Box. AABB consists of a position, a size, and several utility functions. It is typically used for fast overlap tests.
Static methods
staticinlineop_Inequality(left:AABB, right:AABB):Bool
Operator overload for godot.AABB != godot.AABB.
Constructor
new(position:Vector3, size:Vector3)
new(x:Single, y:Single, z:Single, width:Single, height:Single, depth:Single)
new(x:Single, y:Single, z:Single, size:Vector3)
new(position:Vector3, width:Single, height:Single, depth:Single)
Constructs an godot.AABB from a position and size.
Parameters:
position | The position. |
|---|---|
size | The size, typically positive. |
Variables
end:Vector3
Ending corner. This is calculated as godot.AABB.position plus
godot.AABB.size. Setting this value will change the size.
Value:
Getting is equivalent to value = godot.AABB.position + godot.AABB.size,
setting is equivalent to godot.AABB.size = value - godot.AABB.position
position:Vector3
Beginning corner. Typically has values lower than godot.AABB.end.
Value: Directly uses a private field.
size:Vector3
Size from godot.AABB.position to godot.AABB.end. Typically all components are positive.
If the size is negative, you can use godot.AABB.abs to fix it.
Value: Directly uses a private field.
Methods
abs():AABB
Returns an godot.AABB with equivalent position and size, modified so that
the most-negative corner is the origin and the size is positive.
Returns:
The modified godot.AABB.
encloses(with:AABB):Bool
Returns true if this godot.AABB completely encloses another one.
Parameters:
with | The other |
|---|
Returns:
A bool for whether or not this godot.AABB encloses with.
expand(point:Vector3):AABB
Returns this godot.AABB expanded to include a given point.
Parameters:
point | The point to include. |
|---|
Returns:
The expanded godot.AABB.
getEndpoint(idx:Int):Vector3
Gets the position of one of the 8 endpoints of the godot.AABB.
Parameters:
idx | Which endpoint to get. |
|---|
Returns:
An endpoint of the godot.AABB.
getLongestAxis():Vector3
Returns the normalized longest axis of the godot.AABB.
Returns:
A vector representing the normalized longest axis of the godot.AABB.
getLongestAxisIndex():Vector3_Axis
Returns the godot.Vector3_Axis index of the longest axis of the godot.AABB.
Returns:
A godot.Vector3_Axis index for which axis is longest.
getLongestAxisSize():Single
Returns the scalar length of the longest axis of the godot.AABB.
Returns:
The scalar length of the longest axis of the godot.AABB.
getShortestAxis():Vector3
Returns the normalized shortest axis of the godot.AABB.
Returns:
A vector representing the normalized shortest axis of the godot.AABB.
getShortestAxisIndex():Vector3_Axis
Returns the godot.Vector3_Axis index of the shortest axis of the godot.AABB.
Returns:
A godot.Vector3_Axis index for which axis is shortest.
getShortestAxisSize():Single
Returns the scalar length of the shortest axis of the godot.AABB.
Returns:
The scalar length of the shortest axis of the godot.AABB.
getSupport(dir:Vector3):Vector3
Returns the support point in a given direction. This is useful for collision detection algorithms.
Parameters:
dir | The direction to find support for. |
|---|
Returns:
A vector representing the support.
grow(by:Single):AABB
Returns a copy of the godot.AABB grown a given amount of units towards all the sides.
Parameters:
by | The amount to grow by. |
|---|
Returns:
The grown godot.AABB.
hasNoArea():Bool
Returns true if the godot.AABB is flat or empty,
or false otherwise.
Returns:
A bool for whether or not the godot.AABB has area.
hasNoSurface():Bool
Returns true if the godot.AABB has no surface (no size),
or false otherwise.
Returns:
A bool for whether or not the godot.AABB has area.
hasPoint(point:Vector3):Bool
Returns true if the godot.AABB contains a point,
or false otherwise.
Parameters:
point | The point to check. |
|---|
Returns:
A bool for whether or not the godot.AABB contains point.
intersection(with:AABB):AABB
Returns the intersection of this godot.AABB and with.
Parameters:
with | The other |
|---|
Returns:
The clipped godot.AABB.
intersects(with:AABB, ?includeBorders:Bool):Bool
Returns true if the godot.AABB overlaps with with
(i.e. they have at least one point in common).
If includeBorders is true,
they will also be considered overlapping if their borders touch,
even without intersection.
Parameters:
with | The other |
|---|---|
includeBorders | Whether or not to consider borders. |
Returns:
A bool for whether or not they are intersecting.
intersectsPlane(plane:Plane):Bool
Returns true if the godot.AABB is on both sides of plane.
Parameters:
plane | The |
|---|
Returns:
A bool for whether or not the godot.AABB intersects the godot.Plane.
intersectsSegment(from:Vector3, to:Vector3):Bool
Returns true if the godot.AABB intersects
the line segment between from and to.
Parameters:
from | The start of the line segment. |
|---|---|
to | The end of the line segment. |
Returns:
A bool for whether or not the godot.AABB intersects the line segment.
isEqualApprox(other:AABB):Bool
Returns true if this AABB and other are approximately equal,
by running godot.Vector3.isEqualApprox on each component.
Parameters:
other | The other AABB to compare. |
|---|
Returns:
Whether or not the AABBs structures are approximately equal.
merge(with:AABB):AABB
Returns a larger godot.AABB that contains this godot.AABB and with.
Parameters:
with | The other |
|---|
Returns:
The merged godot.AABB.