From 9b6bb5dc8864eaa4ecd00da0f5644c19764ede72 Mon Sep 17 00:00:00 2001 From: Leo Qu Date: Sun, 22 Feb 2026 20:50:40 -0500 Subject: [PATCH] Fix: Keep DC panel in side panel instead of floating (remove FollowPositionForFrames) Co-authored-by: Cursor --- Assets/DCMotorModule.cs | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/Assets/DCMotorModule.cs b/Assets/DCMotorModule.cs index 4a4c012..b040b58 100644 --- a/Assets/DCMotorModule.cs +++ b/Assets/DCMotorModule.cs @@ -11,7 +11,6 @@ public class DCMotorModule : ModuleBase public float rotationSpeed = 90f; private float targetPosition = 0f; - private Coroutine followCoroutine; public void Start() { @@ -23,34 +22,14 @@ public class DCMotorModule : ModuleBase public override void OnSelect() { - if (followCoroutine != null) - StopCoroutine(followCoroutine); - - followCoroutine = StartCoroutine(FollowPositionForFrames()); - motorControlPanel.Initialize(this); - } - - private IEnumerator FollowPositionForFrames() - { - RectTransform panelRect = motorControlPanel.GetComponent(); - - float duration = 0.5f; - float timer = 0f; - - while (timer < duration) - { - Vector3 worldPos = transform.position; - Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos) + new Vector3(150f, 0f, 0f); - panelRect.position = screenPos; - - timer += Time.deltaTime; - yield return null; - } + if (motorControlPanel != null) + motorControlPanel.Initialize(this); } public override void DeSelect() { - motorControlPanel.HidePanel(); + if (motorControlPanel != null) + motorControlPanel.HidePanel(); } public void Rotate(float degrees, int direction)