From 82ba1bb12cd3e2f80c32a6b272e6a6c716f049d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Dj=C3=A4rv?= Date: Fri, 23 Feb 2018 22:06:21 +0100 Subject: [PATCH] disable all buttons for X52 throttle and logitech stick --- .../Devices/Logitech 3D Pro/Logitech3DPro.cs | 197 +++++++++--------- .../Saitek X52 Throttle/SaitekX52Throttle.cs | 16 +- 2 files changed, 109 insertions(+), 104 deletions(-) diff --git a/JoystickVisualizer/Assets/Devices/Logitech 3D Pro/Logitech3DPro.cs b/JoystickVisualizer/Assets/Devices/Logitech 3D Pro/Logitech3DPro.cs index 420f4ce..4ca3462 100644 --- a/JoystickVisualizer/Assets/Devices/Logitech 3D Pro/Logitech3DPro.cs +++ b/JoystickVisualizer/Assets/Devices/Logitech 3D Pro/Logitech3DPro.cs @@ -58,104 +58,105 @@ void StickEvent(JoystickState state) break; - - case "Buttons10": - DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); - break; - case "Buttons11": - DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.z); - break; - case "Buttons12": - DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); - break; - case "Buttons13": - DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.z); - break; - - case "Buttons14": - CMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), CMS.transform.localEulerAngles.y, CMS.transform.localEulerAngles.z); - break; - case "Buttons15": - CMS.transform.localEulerAngles = new Vector3(CMS.transform.localEulerAngles.x, CMS.transform.localEulerAngles.y, ((entry.Value == 0) ? 0.0f : -10.0f)); - break; - case "Buttons16": - CMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), CMS.transform.localEulerAngles.y, CMS.transform.localEulerAngles.z); - break; - case "Buttons17": - CMS.transform.localEulerAngles = new Vector3(CMS.transform.localEulerAngles.x, CMS.transform.localEulerAngles.y, ((entry.Value == 0) ? 0.0f : 10.0f)); - break; - case "Buttons18": - CMS.transform.localPosition = new Vector3(CMS.transform.localPosition.x, ((entry.Value == 0) ? 0.0f : -0.10f), CMS.transform.localPosition.z); - break; - - case "Buttons6": - TMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), TMS.transform.localEulerAngles.y, TMS.transform.localEulerAngles.z); - break; - case "Buttons7": - TMS.transform.localEulerAngles = new Vector3(TMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), TMS.transform.localEulerAngles.z); - break; - case "Buttons8": - TMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), TMS.transform.localEulerAngles.y, TMS.transform.localEulerAngles.z); - break; - case "Buttons9": - TMS.transform.localEulerAngles = new Vector3(TMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), TMS.transform.localEulerAngles.z); - break; - - case "Buttons1": - Pickle.transform.localPosition = new Vector3(Pickle.transform.localPosition.x, Pickle.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : 0.25f)); - break; - - case "Buttons4": - MasterMode.transform.localPosition = new Vector3(((entry.Value == 0) ? 0.0f : -0.20f), MasterMode.transform.localPosition.y, MasterMode.transform.localPosition.z); - break; - - case "Buttons2": - PinkyButton.transform.localPosition = new Vector3(PinkyButton.transform.localPosition.x, PinkyButton.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : -0.20f)); - break; - - case "Buttons3": - PinkyLever.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), PinkyLever.transform.localEulerAngles.y, PinkyLever.transform.localEulerAngles.z); - break; - - case "Buttons0": - Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); - break; - case "Buttons5": - Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 10.0f : 20.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); - break; - - case "PointOfViewControllers0": - switch (entry.Value) - { - case -1: // zero - Trim.transform.localEulerAngles = Vector3.zero; - break; - case 0: // up - Trim.transform.localEulerAngles = Vector3.right * 10.0f; - break; - case 4500: // up/right - Trim.transform.localEulerAngles = Vector3.right * 10.0f + Vector3.down * 10.0f; - break; - case 9000: // right - Trim.transform.localEulerAngles = Vector3.down * 10.0f; - break; - case 13500: // down/right - Trim.transform.localEulerAngles = Vector3.down * 10.0f + Vector3.left * 10.0f; - break; - case 18000: // down - Trim.transform.localEulerAngles = Vector3.left * 10.0f; - break; - case 22500: // down/left - Trim.transform.localEulerAngles = Vector3.left * 10.0f + Vector3.up * 10.0f; - break; - case 27000: // left - Trim.transform.localEulerAngles = Vector3.up * 10.0f; - break; - case 31500: // up/left - Trim.transform.localEulerAngles = Vector3.up * 10.0f + Vector3.right * 10.0f; - break; - } - break; + /* + case "Buttons10": + DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); + break; + case "Buttons11": + DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.z); + break; + case "Buttons12": + DMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), DMS.transform.localEulerAngles.y, DMS.transform.localEulerAngles.z); + break; + case "Buttons13": + DMS.transform.localEulerAngles = new Vector3(DMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), DMS.transform.localEulerAngles.z); + break; + + case "Buttons14": + CMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), CMS.transform.localEulerAngles.y, CMS.transform.localEulerAngles.z); + break; + case "Buttons15": + CMS.transform.localEulerAngles = new Vector3(CMS.transform.localEulerAngles.x, CMS.transform.localEulerAngles.y, ((entry.Value == 0) ? 0.0f : -10.0f)); + break; + case "Buttons16": + CMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), CMS.transform.localEulerAngles.y, CMS.transform.localEulerAngles.z); + break; + case "Buttons17": + CMS.transform.localEulerAngles = new Vector3(CMS.transform.localEulerAngles.x, CMS.transform.localEulerAngles.y, ((entry.Value == 0) ? 0.0f : 10.0f)); + break; + case "Buttons18": + CMS.transform.localPosition = new Vector3(CMS.transform.localPosition.x, ((entry.Value == 0) ? 0.0f : -0.10f), CMS.transform.localPosition.z); + break; + + case "Buttons6": + TMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), TMS.transform.localEulerAngles.y, TMS.transform.localEulerAngles.z); + break; + case "Buttons7": + TMS.transform.localEulerAngles = new Vector3(TMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : -10.0f), TMS.transform.localEulerAngles.z); + break; + case "Buttons8": + TMS.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), TMS.transform.localEulerAngles.y, TMS.transform.localEulerAngles.z); + break; + case "Buttons9": + TMS.transform.localEulerAngles = new Vector3(TMS.transform.localEulerAngles.x, ((entry.Value == 0) ? 0.0f : 10.0f), TMS.transform.localEulerAngles.z); + break; + + case "Buttons1": + Pickle.transform.localPosition = new Vector3(Pickle.transform.localPosition.x, Pickle.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : 0.25f)); + break; + + case "Buttons4": + MasterMode.transform.localPosition = new Vector3(((entry.Value == 0) ? 0.0f : -0.20f), MasterMode.transform.localPosition.y, MasterMode.transform.localPosition.z); + break; + + case "Buttons2": + PinkyButton.transform.localPosition = new Vector3(PinkyButton.transform.localPosition.x, PinkyButton.transform.localPosition.y, ((entry.Value == 0) ? 0.0f : -0.20f)); + break; + + case "Buttons3": + PinkyLever.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : -10.0f), PinkyLever.transform.localEulerAngles.y, PinkyLever.transform.localEulerAngles.z); + break; + + case "Buttons0": + Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 0.0f : 10.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); + break; + case "Buttons5": + Trigger.transform.localEulerAngles = new Vector3(((entry.Value == 0) ? 10.0f : 20.0f), Trigger.transform.localEulerAngles.y, Trigger.transform.localEulerAngles.z); + break; + + case "PointOfViewControllers0": + switch (entry.Value) + { + case -1: // zero + Trim.transform.localEulerAngles = Vector3.zero; + break; + case 0: // up + Trim.transform.localEulerAngles = Vector3.right * 10.0f; + break; + case 4500: // up/right + Trim.transform.localEulerAngles = Vector3.right * 10.0f + Vector3.down * 10.0f; + break; + case 9000: // right + Trim.transform.localEulerAngles = Vector3.down * 10.0f; + break; + case 13500: // down/right + Trim.transform.localEulerAngles = Vector3.down * 10.0f + Vector3.left * 10.0f; + break; + case 18000: // down + Trim.transform.localEulerAngles = Vector3.left * 10.0f; + break; + case 22500: // down/left + Trim.transform.localEulerAngles = Vector3.left * 10.0f + Vector3.up * 10.0f; + break; + case 27000: // left + Trim.transform.localEulerAngles = Vector3.up * 10.0f; + break; + case 31500: // up/left + Trim.transform.localEulerAngles = Vector3.up * 10.0f + Vector3.right * 10.0f; + break; + } + break; + */ } } } diff --git a/JoystickVisualizer/Assets/Devices/Saitek X52 Throttle/SaitekX52Throttle.cs b/JoystickVisualizer/Assets/Devices/Saitek X52 Throttle/SaitekX52Throttle.cs index f568e09..5171233 100644 --- a/JoystickVisualizer/Assets/Devices/Saitek X52 Throttle/SaitekX52Throttle.cs +++ b/JoystickVisualizer/Assets/Devices/Saitek X52 Throttle/SaitekX52Throttle.cs @@ -63,17 +63,20 @@ void StickEvent(JoystickState state) Model.SetActive(entry.Value == 1); break; - case "RotationZ": // Left Throttle - // Rotate Z between -30 and 30 + case "Z": // Right Throttle + // Rotate X between -30 and 30 GimbalLeft.transform.eulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, -25), GimbalLeft.transform.eulerAngles.y, GimbalLeft.transform.eulerAngles.z); GimbalRight.transform.eulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, -25), GimbalRight.transform.eulerAngles.y, GimbalRight.transform.eulerAngles.z); break; - case "Z": // Right Throttle - // Rotate X between -30 and 30 - // GimbalRight.transform.eulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, -25), GimbalRight.transform.eulerAngles.y, GimbalRight.transform.eulerAngles.z); + + + /* + case "RotationZ": // Left Throttle + // Rotate Z between -30 and 30 + GimbalLeft.transform.eulerAngles = new Vector3(ConvertRange(entry.Value, 0, 65535, 40, -25), GimbalLeft.transform.eulerAngles.y, GimbalLeft.transform.eulerAngles.z); break; - + case "Buttons28": // Right Throttle Idle/Off if (entry.Value == 0) GimbalRight.transform.eulerAngles = new Vector3(-25, GimbalRight.transform.eulerAngles.y, GimbalRight.transform.eulerAngles.z); @@ -228,6 +231,7 @@ void StickEvent(JoystickState state) case "Buttons13": PinkySwitch.transform.localEulerAngles = Vector3.up * ((entry.Value == 0) ? 0.0f : -FLIP_SWITCH_ROTATION); break; + */ } } }