Box
A Box represents a volume axis-aligned to a given space : it is defined with only two Number3, a minimum and a maximum, which represent the extents of the box along the axes of that space.
For example, a Shape.BoundingBox is axis-aligned to the model space of that shape, pertaining to its blocks.
However, an Object.CollisionBox is axis-aligned to the world space of the scene, like most physics-related boxes.
When using or creating an axis-aligned Box, be mindful of what space it is relevant to.
Constructors
Creates a default Box with no volume, or with given minimum and maximum points.
-- creates a box with both min & max = {0,0,0} local box = Box() box = Box({0,0,0}, {10,10,10})
Functions
Cast the Box along the given direction vector until max distance is reached, if provided.
The box will collide with any objects matching the filterIn collision groups. If nil is provided, the ray collides with all CollisionGroups by default.
Additionally, an object can be provided as filterOut to exclude it as a potential result. However, it is generally a best practice to filter using collision groups.
Sets the box to a bounding box fitting the given target's model.
Config table can contain any of the following: { recursive=boolean, localBox=boolean },
- recursive: the box will also fit all of target's descendants models. Default is false.
- localBox: result box will be in target's parent local space. Default is false, returning a box in world space.