PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

WorldPivot

Model

CFrame

This property determines where the pivot of a Model which does not have a set Model/PrimaryPart is located. If the Model does have a Model/PrimaryPart|PrimaryPart, the pivot of the Model is equal to the pivot of that primary part instead, and this Model/WorldPivot|WorldPivot property is ignored.


Code Samples


Reset Pivot

This code sample shows a custom function for resetting the pivot of a model back to the center of that model’s bounding box.

local function resetPivot(model)
	local boundsCFrame = model:GetBoundingBox()
	if model.PrimaryPart then
		model.PrimaryPart.PivotOffset = model.PrimaryPart.CFrame:ToObjectSpace(boundsCFrame)
	else
		model.WorldPivot = boundsCFrame
	end
end