From 49c30650f5672c2e844d9256617c01273d7db7ae Mon Sep 17 00:00:00 2001 From: march3 Date: Sat, 18 Mar 2023 19:39:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E9=98=B3=E7=B3=BB=E4=B8=89=E4=BD=93?= =?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 --- simulators/views/ursina_view.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/simulators/views/ursina_view.py b/simulators/views/ursina_view.py index f2a0928..caa8717 100644 --- a/simulators/views/ursina_view.py +++ b/simulators/views/ursina_view.py @@ -28,6 +28,7 @@ class UrsinaPlayer(FirstPersonController): """ """ + # body_rotation_speed_control = 1.0 def __init__(self, position, view_azimuth=0, targets=None): @@ -260,15 +261,18 @@ class Planet(Entity): self.clear_trails() def follow_parent(self): - if not hasattr(self.body_view, "bodies_system"): - return - sys = self.body_view.bodies_system - for b in sys.bodies: - if self.body_view.body.parent == b: - pos = b.position * UrsinaConfig.SCALE_FACTOR - self.x = -pos[1] - self.y = pos[2] - self.z = pos[0] + if not hasattr(self, "f_parent"): + if not hasattr(self.body_view, "bodies_system"): + return + sys = self.body_view.bodies_system + for b in sys.bodies: + if self.body_view.body.parent == b: + self.f_parent = b + break + pos = self.f_parent.position * UrsinaConfig.SCALE_FACTOR + self.x = -pos[1] + self.y = pos[2] + self.z = pos[0] def create_rings(self): """ -- GitLab