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

@:op(A == B)staticinlineop_Equality(left:AABB, right:AABB):Bool

Operator overload for godot.AABB == godot.AABB.

@:op(A != B)staticinlineop_Inequality(left:AABB, right:AABB):Bool

Operator overload for godot.AABB != godot.AABB.

Constructor

@:native("new")new(position:Vector3, size:Vector3)

@:native("new")new(x:Single, y:Single, z:Single, width:Single, height:Single, depth:Single)

@:native("new")new(x:Single, y:Single, z:Single, size:Vector3)

@:native("new")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

@:native("End")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

@:native("Position")position:Vector3

Beginning corner. Typically has values lower than godot.AABB.end.

Value: Directly uses a private field.

@:native("Size")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

@:native("Abs")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.

@:native("Encloses")encloses(with:AABB):Bool

Returns true if this godot.AABB completely encloses another one.

Parameters:

with

The other godot.AABB that may be enclosed.

Returns:

A bool for whether or not this godot.AABB encloses with.

@:native("Expand")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.

@:native("GetArea")getArea():Single

Returns the area of the godot.AABB.

Returns:

The area.

@:native("GetEndpoint")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.

@:native("GetLongestAxis")getLongestAxis():Vector3

Returns the normalized longest axis of the godot.AABB.

Returns:

A vector representing the normalized longest axis of the godot.AABB.

@:native("GetLongestAxisIndex")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.

@:native("GetLongestAxisSize")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.

@:native("GetShortestAxis")getShortestAxis():Vector3

Returns the normalized shortest axis of the godot.AABB.

Returns:

A vector representing the normalized shortest axis of the godot.AABB.

@:native("GetShortestAxisIndex")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.

@:native("GetShortestAxisSize")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.

@:native("GetSupport")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.

@:native("Grow")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.

@:native("HasNoArea")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.

@:native("HasNoSurface")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.

@:native("HasPoint")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.

@:native("Intersection")intersection(with:AABB):AABB

Returns the intersection of this godot.AABB and with.

Parameters:

with

The other godot.AABB.

Returns:

The clipped godot.AABB.

@:native("Intersects")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 godot.AABB to check for intersections with.

includeBorders

Whether or not to consider borders.

Returns:

A bool for whether or not they are intersecting.

@:native("IntersectsPlane")intersectsPlane(plane:Plane):Bool

Returns true if the godot.AABB is on both sides of plane.

Parameters:

plane

The godot.Plane to check for intersection.

Returns:

A bool for whether or not the godot.AABB intersects the godot.Plane.

@:native("IntersectsSegment")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.

@:native("IsEqualApprox")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.

@:native("Merge")merge(with:AABB):AABB

Returns a larger godot.AABB that contains this godot.AABB and with.

Parameters:

with

The other godot.AABB.

Returns:

The merged godot.AABB.

@:native("ToString")toString():String

@:native("ToString")ToString(format:String):String

Converts this godot.AABB to a string.

Returns:

A string representation of this AABB.