# -*- coding:utf-8 -*- # title :月球和地球地形相似模拟 # description :月球和地球地形相似模拟 # author :Python超人 # date :2023-05-01 # link :https://gitcode.net/pythoncr/ # python_version :3.8 # ============================================================================== from bodies import Earth, Moon from common.consts import SECONDS_PER_DAY, SECONDS_PER_WEEK, SECONDS_PER_MONTH from sim_scenes.func import ursina_run, camera_look_at, create_sphere_sky from simulators.ursina.ursina_config import UrsinaConfig from simulators.ursina.ursina_event import UrsinaEvent if __name__ == '__main__': """ 月球和地球地形相似模拟 """ earth = Earth(init_position=[0, 0, 0], rotation_speed=0, rotate_angle=0, init_velocity=[0, 0, 0], size_scale=4e1) # 地球放大 5 倍,距离保持不变 moon = Moon(init_position=[0, 0, 0], rotation_speed=0, init_velocity=[0, 0, 0], size_scale=8e1) # 月球放大 10 倍,距离保持不变 earth.rotation_speed = 0 bodies = [earth, moon] def on_ready(): # 运行前触发 create_sphere_sky(scale=8000) # 运行前会触发 on_ready UrsinaEvent.on_ready_subscription(on_ready) # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- ursina_run(bodies, SECONDS_PER_WEEK, position=(0, 0, -1000000), gravity_works=False, cosmic_bg='', show_grid=False, show_trail=True)