Bounds
The Bounds class represents a bounding box of an object.
Usage
To use this class, add the following require at the top of your script:
Reference
new
Creates a new Bounds instance.
Parameters
center(Vector3): The center of the bounds.size(Vector3): The total size of the bounds.
Returns
Bounds: new Bounds object.
get
Gets the center and size of the bounds as separate values.
Returns
number: The X component of the centernumber: The Y component of the centernumber: The Z component of the centernumber: The X component of the sizenumber: The Y component of the sizenumber: The Z component of the size
getSize
Gets the size (full extents * 2) of the bounds.
Returns
Vector3: full size of the bounds.
setSize
Sets the size of the bounds.
Parameters
value(Vector3): The new size of the bounds.
getMin
Gets the minimum corner of the bounds.
Returns
Vector3: minimum corner position.
setMin
Sets the minimum corner, adjusting the bounds accordingly.
Parameters
value(Vector3): The new minimum corner.
getMax
Gets the maximum corner of the bounds.
Returns
Vector3: maximum corner position.
setMax
Sets the maximum corner, adjusting the bounds accordingly.
Parameters
value(Vector3): The new maximum corner.
setMinMax
Sets both the minimum and maximum corners, recalculating center and extents.
Parameters
min(Vector3): The new minimum corner.max(Vector3): The new maximum corner.
encapsulate
Expands the bounds to encapsulate a given point.
Parameters
point(Vector3): The point to include within the bounds.
expand
Expands the bounds by a given amount.
Parameters
amount(number|Vector3): The amount to expand by (uniformly if number, per axis if Vector3).
intersects
Checks if this bounds intersects with another.
Parameters
bounds(Bounds): The other bounds to check against.
Returns
boolean: if the bounds intersect.
contains
Checks if a point is contained within the bounds.
Parameters
p(Vector3): The point to check.
Returns
boolean: if the point is inside the bounds.