From f1f315c899a4d1308407cc24b9f940083e0b8da2 Mon Sep 17 00:00:00 2001 From: march3 Date: Tue, 26 Mar 2024 14:05:20 +0800 Subject: [PATCH] =?UTF-8?q?Python=E8=B6=85=E4=BA=BA-=E5=AE=87=E5=AE=99?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sim_scenes/featured/jupiter_moon_protects_earth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sim_scenes/featured/jupiter_moon_protects_earth.py b/sim_scenes/featured/jupiter_moon_protects_earth.py index e981361..284d447 100644 --- a/sim_scenes/featured/jupiter_moon_protects_earth.py +++ b/sim_scenes/featured/jupiter_moon_protects_earth.py @@ -191,6 +191,10 @@ class JupiterMoonProtectsEarthSim(UniverseSimScenes): if collided: # 如果碰撞了,则该石头重复再利用,这样才保证有无限个石头可用 pos, vel = self.random_pos_vel() + comet.planet.on_reset() + comet.planet.trails.clear() + if hasattr(comet.planet, "trail_last_pos"): + delattr(comet.planet, "trail_last_pos") comet.init_position = pos comet.init_velocity = vel comet.set_visible(True) @@ -290,7 +294,7 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(sim.bodies, SECONDS_PER_MONTH / 6, + ursina_run(sim.bodies, SECONDS_PER_MONTH / 2, position=(AU, AU * 5, -AU * 5), cosmic_bg='', show_grid=False, -- GitLab