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.
How to rotate a group of floating, anchored bricks, on a center axis?
1 answer
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
4 comments
Problem is I wasn't sure how to weld an anchored part to them. I tried using something I found on the wiki "WeldBetween" but that didn't work.
Ok I'm getting somewhere, but some parts are spazzing out for no reason
oMG I think I got it to work thanks so much man!
Now the bricks are spazzing out a little bit, if you look close. what'd id o wrong q *only happens in online games
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
It sounds like you need to un-anchor the bricks and weld them together.
You don't need to, though that would also be a solution