Hello.
I am trying to orbit a train in a circular motion around a fixed brick. I have tried to implement solutions I have found around the forums for my problem but i’m not getting the results I need. I am still new to cFrames. I understand the fundamentals of cFrames like how they matrices and the functions you can use to manipulate them, I just cant wrap my head around this problem for some reason.
My code is below. When ran, the object does not rotate, it only rotates about its own axis in place, instead of rotating around the axis of the object. the gif shows whats happens:
https://gyazo.com/8bb49e6a0b976fffd0284de06c2b6ace
local playhouse = game.Workspace:WaitForChild('PlayHouse')
local origin = playhouse.origin
local train = script.Parent
i = 0
while true do
train.CFrame = CFrame.new(origin.Position) * CFrame.new(0,0,20) * CFrame.Angles(0,i,0)
i = i+ math.rad(5)
wait()
end