From 2b5c9c2662a24624782af877bf1c7cd131403f30 Mon Sep 17 00:00:00 2001 From: march3 Date: Sat, 8 Apr 2023 13:11:14 +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 --- .../solar_system/speed_of_light_init.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sim_scenes/solar_system/speed_of_light_init.py b/sim_scenes/solar_system/speed_of_light_init.py index ad54e9d..7ef8757 100644 --- a/sim_scenes/solar_system/speed_of_light_init.py +++ b/sim_scenes/solar_system/speed_of_light_init.py @@ -94,6 +94,24 @@ class SpeedOfLightInit: # 订阅计时器事件(记录已到达天体列表) UrsinaEvent.on_timer_changed_subscription(self.on_timer_changed) + def light_body_input(self, key): + # TODO: 在这里控制光体的运动 + # if self.light_body.planet.hovered: + if key == "w": + # 上 + pass + elif key == "s": + # 上 + pass + elif key == "a": + # 左 + pass + elif key == "d": + # 右 + pass + # self.light_body.velocity[1] = 1 + # self.light_body.planet.update() + def on_ready(self): """ 模拟器开始运行前触发 @@ -108,6 +126,7 @@ class SpeedOfLightInit: elif self.__camera_follow_light == "ForwardView": # self.light_body.planet.enabled = False camera.parent = self.light_body.planet + self.light_body.planet.input = self.light_body_input camera.rotation_y = -15 def on_timer_changed(self, time_text, time_data): -- GitLab