提交 ef6e4c8e 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 b35e0d2c
......@@ -19,7 +19,7 @@ class EarthSeasonsSim(EarthSeasonsSimBase):
super(EarthSeasonsSim, self).__init__(sun_transparent=False,
show_sphere_sky=False,
look_at_earth=False,
exit_at_total_days=400,
# exit_at_total_days=400,
earth_cn_size_factor=1.01,
show_name=False)
......@@ -33,4 +33,4 @@ if __name__ == '__main__':
摄像机以侧视图(秋分侧)看太阳和地球(四季和24节气)
"""
sim = EarthSeasonsSim()
sim.run((3 * AU, AU, 0))
sim.run(init_position=(3 * AU, AU, 0), speed_factor=10.0)
......@@ -19,7 +19,7 @@ class EarthSeasonsSim(EarthSeasonsSimBase):
super(EarthSeasonsSim, self).__init__(sun_transparent=False,
show_sphere_sky=False,
look_at_earth=False,
exit_at_total_days=400,
# exit_at_total_days=400,
earth_cn_size_factor=1.01,
show_name=False)
......@@ -33,4 +33,4 @@ if __name__ == '__main__':
摄像机以侧视图(夏至侧)看太阳和地球(四季和24节气)
"""
sim = EarthSeasonsSim()
sim.run((0, AU, -3 * AU))
sim.run(init_position=(0, AU, -3 * AU), speed_factor=10.0)
......@@ -13,13 +13,13 @@ from sim_scenes.func import camera_look_at
class EarthSeasonsSim(EarthSeasonsSimBase):
window_size = (1920 / 3, 1080 / 3)
window_size = (1920 / 2, 1080 / 2)
def __init__(self):
super(EarthSeasonsSim, self).__init__(sun_transparent=False,
show_sphere_sky=False,
look_at_earth=False,
exit_at_total_days=400,
# exit_at_total_days=400,
earth_cn_size_factor=1.01,
show_name=False)
......@@ -33,4 +33,4 @@ if __name__ == '__main__':
摄像机以俯视图看太阳和地球(四季和24节气)
"""
sim = EarthSeasonsSim()
sim.run((0, 4 * AU, 0))
sim.run(init_position=(0, 4 * AU, 0), speed_factor=10.0)
......@@ -152,7 +152,7 @@ class EarthSeasonsSimBase(UniverseSimScenes):
from ursina import application, invoke
def delay_app_start():
import time
time.sleep(8.0)
time.sleep(8.0 / self.speed_factor)
self.wait_days_count = 0
application.paused = False
......@@ -199,7 +199,8 @@ class EarthSeasonsSimBase(UniverseSimScenes):
# print(camera.rotation_y)
def run(self, init_position=(0, 0, 0)):
def run(self, init_position=(0, 0, 0), speed_factor=1.0):
self.speed_factor = speed_factor
# 订阅事件后,上面2个函数功能才会起作用
# 运行前会触发 on_ready
UrsinaEvent.on_ready_subscription(self.on_ready)
......@@ -210,7 +211,7 @@ class EarthSeasonsSimBase(UniverseSimScenes):
# 使用 ursina 查看的运行效果
# 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹
# position = 左-右+、上+下-、前+后-
ursina_run(self.bodies, SECONDS_PER_DAY,
ursina_run(self.bodies, SECONDS_PER_DAY * speed_factor,
position=init_position, # 摄像机和太阳是相同位置
show_name=self.show_name,
show_grid=False,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册