File: Box3.md | Updated: 11/15/2025
Represents an axis-aligned bounding box (AABB) in 3D space.
Constructs a new bounding box.
min | A vector representing the lower boundary of the box. Default is (Infinity,Infinity,Infinity).
---|---
max | A vector representing the upper boundary of the box. Default is (-Infinity,-Infinity,-Infinity).
This flag can be used for type testing.
Default is true.
The upper boundary of the box.
The lower boundary of the box.
Transforms this bounding box by the given 4x4 transformation matrix.
matrix | The transformation matrix.
---|---
Returns: A reference to this bounding box.
Clamps the given point within the bounds of this box.
point | The point to clamp.
---|---
target | The target vector that is used to store the method's result.
Returns: The clamped point.
Returns a new box with copied values from this instance.
Returns: A clone of this instance.
Returns true if this bounding box includes the entirety of the given bounding box. If this box and the given one are identical, this function also returns true.
box | The bounding box to test.
---|---
Returns: Whether the bounding box contains the given bounding box or not.
Returns true if the given point lies within or on the boundaries of this box.
point | The point to test.
---|---
Returns: Whether the bounding box contains the given point or not.
Copies the values of the given box to this instance.
box | The box to copy.
---|---
Returns: A reference to this bounding box.
Returns the euclidean distance from any edge of this box to the specified point. If the given point lies inside of this box, the distance will be 0.
point | The point to compute the distance to.
---|---
Returns: The euclidean distance.
Returns true if this bounding box is equal with the given one.
box | The box to test for equality.
---|---
Returns: Whether this bounding box is equal with the given one.
Expands the boundaries of this box to include the given 3D object and its children, accounting for the object's, and children's, world transforms. The function may result in a larger box than strictly necessary (unless the precise parameter is set to true).
object | The 3D object that should expand the bounding box.
---|---
precise | If set to true, the method expands the bounding box as little as necessary at the expense of more computation. Default is false.
Returns: A reference to this bounding box.
Expands the boundaries of this box to include the given point.
point | The point that should be included by the bounding box.
---|---
Returns: A reference to this bounding box.
Expands each dimension of the box by the given scalar. If negative, the dimensions of the box will be contracted.
scalar | The scalar value that should expand the bounding box.
---|---
Returns: A reference to this bounding box.
Expands this box equilaterally by the given vector. The width of this box will be expanded by the x component of the vector in both directions. The height of this box will be expanded by the y component of the vector in both directions. The depth of this box will be expanded by the z component of the vector in both directions.
vector | The vector that should expand the bounding box.
---|---
Returns: A reference to this bounding box.
Returns a serialized structure of the bounding box.
json | The serialized json to set the box from.
---|---
Returns: A reference to this bounding box.
Returns a bounding sphere that encloses this bounding box.
target | The target sphere that is used to store the method's result.
---|---
Returns: The bounding sphere that encloses this bounding box.
Returns the center point of this box.
target | The target vector that is used to store the method's result.
---|---
Returns: The center point.
Returns a point as a proportion of this box's width, height and depth.
point | A point in 3D space.
---|---
target | The target vector that is used to store the method's result.
Returns: A point as a proportion of this box's width, height and depth.
Returns the dimensions of this box.
target | The target vector that is used to store the method's result.
---|---
Returns: The size.
Computes the intersection of this bounding box and the given one, setting the upper bound of this box to the lesser of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds. If there's no overlap, makes this box empty.
box | The bounding box to intersect with.
---|---
Returns: A reference to this bounding box.
Returns true if the given bounding box intersects with this bounding box.
box | The bounding box to test.
---|---
Returns: Whether the given bounding box intersects with this bounding box.
Returns true if the given plane intersects with this bounding box.
plane | The plane to test.
---|---
Returns: Whether the given plane intersects with this bounding box.
Returns true if the given bounding sphere intersects with this bounding box.
sphere | The bounding sphere to test.
---|---
Returns: Whether the given bounding sphere intersects with this bounding box.
Returns true if the given triangle intersects with this bounding box.
triangle | The triangle to test.
---|---
Returns: Whether the given triangle intersects with this bounding box.
Returns true if this box includes zero points within its bounds. Note that a box with equal lower and upper bounds still includes one point, the one both bounds share.
Returns: Whether this box is empty or not.
Makes this box empty which means in encloses a zero space in 3D.
Returns: A reference to this bounding box.
Sets the lower and upper boundaries of this box. Please note that this method only copies the values from the given objects.
min | The lower boundary of the box.
---|---
max | The upper boundary of the box.
Returns: A reference to this bounding box.
Sets the upper and lower bounds of this box so it encloses the position data in the given array.
array | An array holding 3D position data.
---|---
Returns: A reference to this bounding box.
Sets the upper and lower bounds of this box so it encloses the position data in the given buffer attribute.
attribute | A buffer attribute holding 3D position data.
---|---
Returns: A reference to this bounding box.
Centers this box on the given center vector and sets this box's width, height and depth to the given size values.
center | The center of the box.
---|---
size | The x, y and z dimensions of the box.
Returns: A reference to this bounding box.
Computes the world-axis-aligned bounding box for the given 3D object (including its children), accounting for the object's, and children's, world transforms. The function may result in a larger box than strictly necessary.
object | The 3D object to compute the bounding box for.
---|---
precise | If set to true, the method computes the smallest world-axis-aligned bounding box at the expense of more computation. Default is false.
Returns: A reference to this bounding box.
Sets the upper and lower bounds of this box so it encloses the position data in the given array.
points | An array holding 3D position data as instances of Vector3.
---|---
Returns: A reference to this bounding box.
Returns a serialized structure of the bounding box.
Returns: Serialized structure with fields representing the object state.
Adds the given offset to both the upper and lower bounds of this bounding box, effectively moving it in 3D space.
offset | The offset that should be used to translate the bounding box.
---|---
Returns: A reference to this bounding box.
Computes the union of this box and another and the given one, setting the upper bound of this box to the greater of the two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.
box | The bounding box that will be unioned with this instance.
---|---
Returns: A reference to this bounding box.