Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Make a Part Move in a Circle?

Asked by 4 years ago

Is there a straightforward way to make a single part/union move in a circle (not just rotate 360, but actually travel in a circle of some radius)? I am not sure whether BodyPositions are the best way to go about this, but I'd appreciate any advice.

0
There are different ways to do so. Try researching the Developer Hub (or maybe use Google). Have you tried doing so in a script? starlebVerse 685 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Hi there! I usually take an oversized wide cylinder, duplicate it. Cut out the shape of the object I need by inserting two spheres apart from each other, negating then union them. So I then have a mold. I insert my script into the other cylinder then take my mold and negate it and union it together. I'm left with two spheres circling and I can change the speed on them. For just one sphere or object I don't know of an easy way. I used to have a long script for it on my old computer before it crashed. The one I use for the above example is:

while true do script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0.07,0,0) wait(0.05) end

It's kind of cheating because the object is just rotating, you've just cut it into smaller pieces that look like they are circling each-other. Or you can try the below script. It's almost a circle, kind of more square, but maybe if it moves fast enough it'll look like a circle! I hope somehow I was helpful!

for i=1, 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 1 do distance = 50

wait() for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(-0.05,0, -.02) wait() end

wait() for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame-Vector3.new(-.02,0,-0.05) wait() end

wait() for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0.05,0, 0.02) wait() end

wait() for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame-Vector3.new(0.02,0,0.05) wait() end

end

Ad

Answer this question