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

Python超人-宇宙模拟器

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