PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

GetBoundingBox

This function returns a description of a volume that contains all BasePart children within a Model. The volume’s orientation is based on the orientation of the Model/PrimaryPart|PrimaryPart, and matches the selection box rendered in Studio when the model is selected. The description is provided in the form of a DataType/CFrame orientation and DataType/Vector3 size.

Mirroring the behavior of Terrain/FillBlock, it returns a CFrame representing the center of that bounding box and a Vector3 representing its size.

If there is no PrimaryPart for the model, the BoundingBox will be aligned to the world axes.

Example

Pictured below is a Model with a pink semitransparent Part whose BasePart/CFrame|CFrame and BasePart/Size|Size have been set to the return values of this function called on the model.

A model of an Observation Tower with a pink semitransparent part representing the volume returned by GetBoundingBox

Usage

local model = workspace.Model
local part = workspace.Part
local orientation, size = model:GetBoundingBox()
part.Size = size
part.CFrame = orientation

Returns

Return Type Summary

A DataType/CFrame representing the orientation of the volume followed by a DataType/Vector3 representing the size of the volume