PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetExtentsSize

Returns the size of the smallest bounding box that contains all of the BaseParts in the Model. If Model/PrimaryPart exists then the bounding box will be aligned to that part. If a primary part has not been set then the function will chose a part in the model to align the bounding box to. As the the selection of this part is not deterministic it is recommended to set a Model/PrimaryPart to get consistent results with this function.

Note this function only returns the size of the smallest bounding box, and the developer must employ their own method to obtain the position of the bounding box.

Returns

Return Type Summary

The DataType/Vector3 extents size of the Model.


Code Samples


Model GetExtentsSize

The code sample below demonstrates how Model.GetExtentsSize can be used to get the size of the bounding box containing the parts.

local model = Instance.new('Model', Workspace) -- Create a model.
 
for i = 1, 5 do
	-- Fill the model with randomly positioned parts.
	local part = Instance.new('Part', model)
	part.Anchored = true
	part.Size = Vector3.new(math.random(5), math.random(5), math.random(5))
end
 
print(model:GetExtentsSize())