From 9bb46532dc3722de2f72bbbfe8985b1e6ebb2c1d Mon Sep 17 00:00:00 2001 From: march3 Date: Tue, 11 Jul 2023 20:44:50 +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/science/jupiter_moon_protects_earth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sim_scenes/science/jupiter_moon_protects_earth.py b/sim_scenes/science/jupiter_moon_protects_earth.py index df0a0f6..327eb11 100644 --- a/sim_scenes/science/jupiter_moon_protects_earth.py +++ b/sim_scenes/science/jupiter_moon_protects_earth.py @@ -185,6 +185,7 @@ class JupiterProtectsEarthSim: self.text_panel.text = colliding_info def on_ready(self): + from ursina import application # 运行前触发 self.text_panel = create_text_panel() self.text_panel.text = self.colliding_info % (0, "0.0%", @@ -192,6 +193,7 @@ class JupiterProtectsEarthSim: 0, "0.0%", 0, "0.0%", 0, 0) + application.time_scale = 3 if __name__ == '__main__': @@ -202,7 +204,7 @@ if __name__ == '__main__': # 设置计时器的最小时间单位为年 BodyTimer().min_unit = BodyTimer.MIN_UNIT_YEARS - sim = JupiterProtectsEarthSim(comet_num=50) + sim = JupiterProtectsEarthSim(comet_num=30) # 运行前会触发 on_ready UrsinaEvent.on_ready_subscription(sim.on_ready) @@ -212,6 +214,6 @@ if __name__ == '__main__': # 使用 ursina 查看的运行效果 # 常用快捷键: P:运行和暂停 O:重新开始 I:显示天体轨迹 # position = 左-右+、上+下-、前+后- - ursina_run(sim.bodies, SECONDS_PER_MONTH, + ursina_run(sim.bodies, SECONDS_PER_MONTH * 3, position=(30000000, 0, -3000000000), show_timer=True) -- GitLab