How would I create circular movement?

I’m not sure how to get each point of a circle since it’s in 3D space (so

x = r * cos(𝜃) + Xc

y = r * sin(𝜃) + Yc

won’t work). There’s probably easier ways to do this with bodymovers, but how could I loop an object to change it’s CFrame one degree at a time around a circle by getting the coordinates of each point of the circle?

4 Likes

This post might help you. [Math] How can I rotate the earth around the sun while the moon rotating around the earth

1 Like

You’re on the right track. A circle is still a 2 dimensional shape even in 3 dimensions, so you get to decide which axes you care about.

local radius = 50
local Xc = 0
local Yc = 0

for angle = 0, 359 do
  local x = radius * math.cos(math.rad(angle)) + Xc
  local y = radius * math.sin(math.rad(angle)) + Yc
  part.CFrame = CFrame.new(x, y, 0)
  wait()
end

If you want to make a circle flat on the XZ plane, you would just do CFrame.new(x, 0, y).

4 Likes