rishabbansal21

Learn 3D Games in Python | Ursina Engine | Part-7 Solar System Animation

May 13th, 2021
667
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from ursina import *
  2.  
  3. def update():
  4.     for i in l:
  5.         i.rotation_y += 2
  6.  
  7. def input(key):
  8.     if key == '1':
  9.         camera.position=(0,0,-20)
  10.         camera.rotation_x = 0
  11.  
  12.     if key == '2':
  13.         camera.position=(0,20,0)
  14.         camera.rotation_x = 90
  15.  
  16.     if key == '3':
  17.         camera.position=(0,10,-17)
  18.         camera.rotation_x = 30
  19.  
  20. app = Ursina()
  21.  
  22. sun = Entity(model="sphere", color=color.yellow, scale=2, texture='sun.jpg')
  23. earth = Entity(parent=sun, model="sphere", scale=0.4, position=(1,0,1), texture='earth.jpg')
  24. moon = Entity(parent=earth, model="sphere", scale=0.3, position=(0.5,0,0.5), color=color.white)
  25.  
  26. l = [sun, earth, moon]
  27.  
  28. app.run()
RAW Paste Data