Rotate around a pivot using CFrame

How do I rotate a Part around a point (pivot - x,y,z) using CFrame?

5 Likes

What I do is “rotate” the pivot and then offset the part relative to the new pivot’s CFrame. So for example:

local pivot = Vector3.new(0, 0, 0)
local part = workspace.Part

local newPivot = CFrame.new(pivot) -- Create decoy pivot that will "rotate"
local offset = newPivot:ToObjectSpace(part.CFrame) -- Get the offset from the part to the pivot
while task.wait() do
newPivot = newPivot * CFrame.Angles(0, math.rad(1), 0) -- Rotate the pivot
part.CFrame = newPivot * offset -- Re-offset the part from the new rotation
end
28 Likes

Thank you! …

1 Like