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:
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
So, i think you can insert a humanoid in the train and invisible parts in the trails, and may work like this:
target1; target;2 target3;… when the train touch the target1, automatically it new target is changed to target2.
SORRY FOR THE RIDICULOUS BAD ENGLISH AND GRAMMAR I DO NOT SPEK ENG VERY WELL but you may understand