SHARE
TWEET

Untitled

a guest Sep 15th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Constants --
  2. local Planet = script.Parent
  3. local Star = workspace.Sol.Head
  4. local Distance = (Planet.Position-Star.Position).Magnitude
  5. local ElipseX = 0
  6. local ElipseZ = 0
  7. local Speed = 0.30
  8. local Position = Vector3.new(Distance+ElipseX,math.rad(0),Distance+ElipseZ)
  9. local StartPos = math.deg(math.atan2((Planet.Position.Z - Star.Position.Z), (Planet.Position.X - Star.Position.X)))
  10.  
  11. -- Move object --
  12. while true do
  13.     for x = StartPos,360+StartPos,Speed do
  14.         local Theta = math.rad(x)
  15.         Planet.CFrame = Star.CFrame * CFrame.Angles(Position.Y,0,0) * CFrame.new(Position.X*math.cos(Theta),0,Position.Z*math.sin(Theta))
  16.         wait()
  17.     end
  18. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top