I’m trying to make a small helicopter mesh go in a circular motion, like an orbit, around a large building.
I know how to make it move in an orbit, and I’m unsure how to point the helicopter so that the nose is always facing the way its moving. When I use an orbit script the heli will move in a circle, but the model itself will not rotate. Any help is appreciated.
Use the angle you’re determining the position from to determine the angle as well:
local pos = script.Parent.BodyPosition
local gy = script.Parent.BodyGyro
local RADIUS = 50
local HEIGHT = 50
local function setAngle(theta)
pos.Position = Vector3.new(math.cos(theta) * RADIUS, HEIGHT, math.sin(theta) * RADIUS)
gy.CFrame = CFrame.Angles(0, -theta, 0)
end
while true do
for theta = 0, 360, 0.2 do
setAngle(math.rad(theta))
task.wait(0.01)
end
end