From 13303c97424b6b625c3bd5046864d860cc244f72 Mon Sep 17 00:00:00 2001 From: Felix Klenner Date: Mon, 20 Nov 2023 11:24:52 +0100 Subject: [PATCH] toggle for motors --- Assets/CableJointsAlgorithm.cs | 6 +++--- Assets/Controller.cs | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Assets/CableJointsAlgorithm.cs b/Assets/CableJointsAlgorithm.cs index a4a76a6..dfdc365 100644 --- a/Assets/CableJointsAlgorithm.cs +++ b/Assets/CableJointsAlgorithm.cs @@ -25,11 +25,11 @@ public static class CableJointsAlgorithm { totalDist += dist.distance; - Debug.Log(go.name+": l: +"+left+" r: -"+right); + //Debug.Log(go.name+": l: +"+left+" r: -"+right); } } - Debug.Log("Total distance for cable: "+totalDist); + //Debug.Log("Total distance for cable: "+totalDist); } } @@ -139,7 +139,7 @@ public static class CableJointsAlgorithm { var dist = circumference * delta; - Debug.Log(c.name+": angle1: "+angle1+" angle2: "+angle2+" -> delta: "+delta+" circumferecne: "+circumference+" dist: "+dist); + //Debug.Log(c.name+": angle1: "+angle1+" angle2: "+angle2+" -> delta: "+delta+" circumferecne: "+circumference+" dist: "+dist); return (float) dist; } } \ No newline at end of file diff --git a/Assets/Controller.cs b/Assets/Controller.cs index e77b94a..65c8a0e 100644 --- a/Assets/Controller.cs +++ b/Assets/Controller.cs @@ -126,6 +126,15 @@ public class Controller : MonoBehaviour { private float waitedFrames = 0; // Update is called once per frame void Update() { + if (Input.GetKeyDown(KeyCode.T)) { + foreach (var go in FindObjectsByType(FindObjectsInactive.Exclude, FindObjectsSortMode.None)) { + if (go.GetComponent() != null && go.GetComponent().movement == RollerProperties.RotationType.Powered) { + go.GetComponent().useMotor = !go.GetComponent().useMotor; + Debug.Log("TOGGLED ALL MOTORS"); + } + } + } + if (waitedFrames++ > -1) { CableJointsAlgorithm.TimeStep(cables); waitedFrames = 0;