PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetPartBoundsInBox

GetPartBoundsInBox returns an array of parts whose bounding boxes overlap a box whose volume is described using the given center (CFrame) and size (Vector3).

Beware that this spatial query function efficiently considers the volume of parts’ bounding boxes rather than their actual occupied volume. This may be important when considering cylinders, spheres, unions, and MeshPart, which have non-block shapes. For cases where accuracy particularly matters, use WorldRoot/GetPartsInPart|GetPartsInPart instead or further filter the results of this function yourself.

This function uses an datatype/OverlapParams object to describe reusable portions of the spatial query, such as an instance whitelist/blacklist, the maximum number of parts to query, and what articles/Collision Filtering|collision group to use. When making repeated spatial queries using functions like this, you should construct just one of these objects and reuse it.

This and other spatial query functions do not consider parts’ BasePart/CanCollide|CanCollide or BasePart/CanTouch|CanTouch properties. However, it will consider parts’ collision group if specified by the given OverlapParams.

Parameters

Name Type Default Description

The location of the center of the given box volume to be queried

The size of the given box volume to be queried

OverlapParams{MaxParts=false, CollisionGroup=Default, FilterDescendantsInstances={}}

Contains reusable portions of the spatial query parameters

Returns

Return Type Summary

An array of BasePart which matched the spatial query