Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from visual import *
- scene=display(title="Universe!",x=0, y=0, width=800,
- height=600,range=vector(500000000,500000000,500000000),
- center=vector(0,0,0))
- t = 0.0
- dt = 10000 #change in time
- sMoon = vector(384472282.0, 0.0, 0.0)
- sEarth = vector(0.0,0.0,0.0)
- v = 1023.41 #avg velcoity of moon
- r = 384472282 #distance between earth and moon
- Moon=sphere(pos=sMoon,radius=4000000,color=color.white, make_trail=True, trail_type="points", interval=10, retain=500) #moon model with trail
- Earth=sphere(pos=sEarth, radius=90000000, material=materials.earth) #earth model
- while t < 5000000: #time for program to run
- rate(50) # This slows down the computer to 50 frames per second
- sMoon = (cos(v*t/r)*r,sin(v*t/r)*r,0) #calculates the position of the moon
- Moon.pos=sMoon #updating moon's position
- t = t + dt #updating time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement