I want a script to help make a realistic orbit effect for a planet model I am building. I need a script with the following variables:
Two radius variables to give the effect of the orbit being an OVAL, and not a circle. Orbits are usually slightly oval.
A variable to indicate the tilt of the orbit.
And a variable to indicate the duration of the orbit.
I have found two scripts that have these variables, and I need a method of essentially combining them. These are pasted examples
SCRIPT 1:
orbitPeriod = 2
orbitRadius = 10
orbitVerticalDisplacement = 0
for t = 0, math.huge do
Satellite.Position = CFrame.new(Body.Position)*CFrame.Angles(0, t/orbitPeriod * math.pi/30, 0)*Vector3.new(orbitRadius, orbitVerticalDisplacement, 0)
game['Run Service'].Heartbeat:wait()
end
Pros: has accurate orbit duration and a tilt variable Cons: Perfect circle
SCRIPT 2:
local radiusX = 10
local radiusZ = 20
local center = Vector3.new()
local rad, cos, sin = math.rad, math.cos, math.sin
local totalTime = 50
for i = 1, math.huge do
script.Parent.CFrame = CFrame.new(center.X + radiusX*cos(rad(i40)), center.Y, center.Z + radiusZ*sin(rad(i40)))
wait(totalTime/1440)
end
Pros: oval effect Cons: inaccurate orbit duration and no tilt
This question may seem very strange, but surely there is a way to integrate features from both scripts to make something that works.
