I'm using corner wedges to form a diamond that is floating in the air. I need the diamond to rotate around it's middle. How do I go about doing this? I can rotate them individually but I can't have them float and not be anchored at the same time.
You can accomplish this with welds by unanchoring all them, welding them together, and welding some other anchored object to one of the parts (e.g., the baseplate).
Instead, if you want to use CFrame, you can fairly easily do this using cframe:toObjectSpace(cframe)
and cframe:toWorldSpace(cframe)
:
-- Twists all parts in `model` angle `angle` (in radians) about the Y axis function twist(model, angle) local origin = CFrame.new(); local out = origin * CFrame.Angles(0, angle, 0); for _, part in pairs(model:GetChildren()) do if part:IsA("BasePart") then part.CFrame = out:toWorldSpace( origin:toObjectSpace(part.CFrame) ); end end end
For example, to make it spin, you could use
while true do wait(); twist(workspace.Model, 0.1) end