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

Python超人-宇宙模拟器

上级 897b2c3b
...@@ -22,7 +22,8 @@ if __name__ == '__main__': ...@@ -22,7 +22,8 @@ if __name__ == '__main__':
# 木星在中心位置 # 木星在中心位置
jupiter = Jupiter(init_position=[0, 0, 0], init_velocity=[0, 0, 0], jupiter = Jupiter(init_position=[0, 0, 0], init_velocity=[0, 0, 0],
rotation_speed=0, size_scale=1) # rotation_speed=0,
size_scale=1)
bodies = [jupiter] bodies = [jupiter]
rocks = [] rocks = []
......
...@@ -97,7 +97,7 @@ class UrsinaSimulator(Simulator): ...@@ -97,7 +97,7 @@ class UrsinaSimulator(Simulator):
explosion_file = os.path.join(explosion_file, "explosion") explosion_file = os.path.join(explosion_file, "explosion")
# volume = body.planet.model.volume # volume = body.planet.model.volume
volume = pow(body.planet.model.get_bounds().volume, 1 / 3) / 2000 volume = pow(body.planet.model.get_bounds().volume, 1 / 3) / 2000
ani = Animation(explosion_file, explode_ani = Animation(explosion_file,
position=body.planet.position, position=body.planet.position,
scale=volume * 2, fps=6, scale=volume * 2, fps=6,
loop=False, autoplay=True) loop=False, autoplay=True)
...@@ -105,11 +105,15 @@ class UrsinaSimulator(Simulator): ...@@ -105,11 +105,15 @@ class UrsinaSimulator(Simulator):
if target is not None: if target is not None:
if hasattr(target, "planet"): if hasattr(target, "planet"):
if hasattr(target.planet, "main_entity"): if hasattr(target.planet, "main_entity"):
ani.look_at(target.planet.main_entity) explode_ani.world_parent = target.planet.main_entity
explode_ani.look_at(target.planet.main_entity)
else: else:
ani.look_at(target.planet) explode_ani.world_parent = target.planet
explode_ani.look_at(target.planet)
else: else:
ani.look_at(target) explode_ani.world_parent = target
explode_ani.look_at(target)
return explode_ani
body.look_at = body_look_at body.look_at = body_look_at
body.set_visible = body_visible body.set_visible = body_visible
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册