roblox how to make something go in an elliptical orbit
local center = workspace.Earth;
local moon = script.Parent;
local ORBIT_TIME = 2;
local RADIUS = 10;
local ECLIPSE = 0.5
local ROTATION = CFrame.Angles(0,0,0);
local sin, cos = math.sin, math.cos;
local ROTSPEED = math.pi*2/ORBIT_TIME;
ECLIPSE = ECLIPSE * RADIUS;
local runservice = game:GetService('RunService');
local rot = 0;
game:GetService('RunService').Stepped:connect(function(t, dt)
rot = rot + dt * ROTSPEED;
moon.CFrame = ROTATION * CFrame.new(sin(rot)*ECLIPSE, 0, cos(rot)*RADIUS) + center.Position;
end);