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

Python超人-宇宙模拟器

上级 4079b23c
...@@ -38,9 +38,9 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -38,9 +38,9 @@ class TheLostPlanetSim(UniverseSimScenes):
self.saturn = Saturn(size_scale=0.68e3, distance_scale=0.74) self.saturn = Saturn(size_scale=0.68e3, distance_scale=0.74)
self.ship = ScifiGunship(name="飞船", mass=1e30, color=(111, 140, 255), self.ship = ScifiGunship(name="飞船", mass=1e30, color=(111, 140, 255),
init_position=self.mars.init_position, init_position=self.mars.init_position,
init_velocity=[0, 0, 0], init_velocity=[0, 0, 0],
size_scale=2e4, distance_scale=2.9).\ size_scale=2e4, distance_scale=2.9). \
set_ignore_gravity(True).set_light_disable(True) set_ignore_gravity(True).set_light_disable(True)
self.bodies = [ self.bodies = [
...@@ -107,7 +107,7 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -107,7 +107,7 @@ class TheLostPlanetSim(UniverseSimScenes):
事件绑定后,模拟器运行前会触发 事件绑定后,模拟器运行前会触发
@return: @return:
""" """
from ursina import camera, Vec3 from ursina import camera, Vec3,application
# 创建天空 # 创建天空
create_sphere_sky(scale=20000, rotation_x=0, rotation_y=80) create_sphere_sky(scale=20000, rotation_x=0, rotation_y=80)
...@@ -133,6 +133,7 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -133,6 +133,7 @@ class TheLostPlanetSim(UniverseSimScenes):
# self.asteroids.planet.enabled = False # self.asteroids.planet.enabled = False
self.moon.planet.enabled = False self.moon.planet.enabled = False
application.time_scale = 0.1
# ceres.planet.enabled = False # ceres.planet.enabled = False
# self.moon.planet.look_at(self.mars.planet) # self.moon.planet.look_at(self.mars.planet)
...@@ -351,6 +352,8 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -351,6 +352,8 @@ class TheLostPlanetSim(UniverseSimScenes):
self.create_asteroid(smooth=True) self.create_asteroid(smooth=True)
self.asteroid_num += 1 self.asteroid_num += 1
camera.position += camera.forward*0.1
def moon_move_to_target_and_rotation(self, target, rotation_radius, end_angle, end_tag, def moon_move_to_target_and_rotation(self, target, rotation_radius, end_angle, end_tag,
forward, forward,
angle_val): angle_val):
...@@ -408,6 +411,7 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -408,6 +411,7 @@ class TheLostPlanetSim(UniverseSimScenes):
end_tag="moon_around_earth", end_tag="moon_around_earth",
forward=0.02, angle_val=1) forward=0.02, angle_val=1)
self.steps = [ self.steps = [
(self.asteroid_fade_in, 3, 1), (self.asteroid_fade_in, 3, 1),
(self.asteroid_fade_out, 3, 1), (self.asteroid_fade_out, 3, 1),
...@@ -415,7 +419,8 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -415,7 +419,8 @@ class TheLostPlanetSim(UniverseSimScenes):
# (self.ship_go_to_moon, -1, 1), # (self.ship_go_to_moon, -1, 1),
(self.moon_renovation, 10, -1), (self.moon_renovation, 10, -1),
(step_05, -1, -1), (step_05, -1, -1),
(step_06, -1, -1), (step_06, 50, -1),
(lambda: exit(0), -1, -1)
] ]
def on_timer_changed(self, time_data): def on_timer_changed(self, time_data):
...@@ -474,7 +479,7 @@ class TheLostPlanetSim(UniverseSimScenes): ...@@ -474,7 +479,7 @@ class TheLostPlanetSim(UniverseSimScenes):
if __name__ == '__main__': if __name__ == '__main__':
sim = TheLostPlanetSim() sim = TheLostPlanetSim()
# UniverseSimScenes.set_window_size((1920, 1079), False) UniverseSimScenes.set_window_size((1920, 1079), False)
# 运行前会触发 on_ready # 运行前会触发 on_ready
UrsinaEvent.on_ready_subscription(sim.on_ready) UrsinaEvent.on_ready_subscription(sim.on_ready)
# UrsinaEvent.after_ready_subscription(after_ready) # UrsinaEvent.after_ready_subscription(after_ready)
...@@ -492,7 +497,7 @@ if __name__ == '__main__': ...@@ -492,7 +497,7 @@ if __name__ == '__main__':
# position=(0, 20 * AU, 10 * AU), # position=(0, 20 * AU, 10 * AU),
position=(5.5 * AU, AU, 5 * AU), position=(5.5 * AU, AU, 5 * AU),
timer_enabled=True, timer_enabled=True,
show_timer=True, # show_timer=True,
cosmic_bg='', cosmic_bg='',
# show_trail=True, # show_trail=True,
show_grid=False) show_grid=False)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册