From 516be81ecd1bdd0f3403222dbcff2357feae0117 Mon Sep 17 00:00:00 2001 From: Malin E Date: Mon, 25 Apr 2022 10:45:54 +0200 Subject: [PATCH] Simplify setting of deadzone size in assets --- data/assets/examples/joystickProperty.asset | 4 ++-- data/assets/util/joysticks/ps4.asset | 14 ++++++++------ .../space-mouse-enterprise-wireless.asset | 13 +++++++------ .../util/joysticks/space-mouse-enterprise.asset | 13 +++++++------ data/assets/util/joysticks/xbox-wireless.asset | 14 ++++++++------ data/assets/util/joysticks/xbox.asset | 14 ++++++++------ 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/data/assets/examples/joystickProperty.asset b/data/assets/examples/joystickProperty.asset index 04088a783a..bcd71b14e9 100644 --- a/data/assets/examples/joystickProperty.asset +++ b/data/assets/examples/joystickProperty.asset @@ -25,8 +25,8 @@ -- First - Name of the joystick that should be bound -- Second - Which axis should be bound of this joystick -- Third - The property uri --- Fourth - (optional) The smallest value that you wnat to allow this property on the joystick --- Fifth - (optional) The largest value that you wnat to allow this property on the joystick +-- Fourth - (optional) The smallest value that you want to allow this property on the joystick +-- Fifth - (optional) The largest value that you want to allow this property on the joystick -- Sixth - (optional) Determines whether the axis should be inverted -- Seventh - (optional) Should this property change be sent to other connected remote sessions diff --git a/data/assets/util/joysticks/ps4.asset b/data/assets/util/joysticks/ps4.asset index 829661f96a..8da5b61a39 100644 --- a/data/assets/util/joysticks/ps4.asset +++ b/data/assets/util/joysticks/ps4.asset @@ -52,12 +52,14 @@ asset.onInitialize(function() local controller = PS4Controller; local name = "Wireless Controller"; - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.L2, 0.05) - openspace.navigation.setAxisDeadZone(name, controller.R2, 0.05) + local deadzoneJoysticks = 0.15 + local deadzoneTriggers = 0.05 + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.L2, deadzoneTriggers) + openspace.navigation.setAxisDeadZone(name, controller.R2, deadzoneTriggers) openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X"); openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true); diff --git a/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset b/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset index d561244ca8..e1b5d0ee9c 100644 --- a/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset +++ b/data/assets/util/joysticks/space-mouse-enterprise-wireless.asset @@ -37,12 +37,13 @@ asset.onInitialize(function() local controller = SpaceMouse; local name = "3Dconnexion Universal Receiver"; - openspace.navigation.setAxisDeadZone(name, controller.Push[1], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Push[2], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Twist[1], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Push[3], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], 0.1) + local deadzone = 0.15 + openspace.navigation.setAxisDeadZone(name, controller.Push[1], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Push[2], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Twist[1], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Push[3], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], deadzone) openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X"); openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y"); diff --git a/data/assets/util/joysticks/space-mouse-enterprise.asset b/data/assets/util/joysticks/space-mouse-enterprise.asset index 158555df5a..517d55217e 100644 --- a/data/assets/util/joysticks/space-mouse-enterprise.asset +++ b/data/assets/util/joysticks/space-mouse-enterprise.asset @@ -37,12 +37,13 @@ asset.onInitialize(function() local controller = SpaceMouse; local name = "SpaceMouse Enterprise"; - openspace.navigation.setAxisDeadZone(name, controller.Push[1], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Push[2], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Twist[1], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Push[3], 0.1) - openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], 0.1) + local deadzone = 0.15 + openspace.navigation.setAxisDeadZone(name, controller.Push[1], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Push[2], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Twist[1], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Push[3], deadzone) + openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], deadzone) openspace.navigation.bindJoystickAxis(name, controller.Push[1], "Orbit X"); openspace.navigation.bindJoystickAxis(name, controller.Push[2], "Orbit Y"); diff --git a/data/assets/util/joysticks/xbox-wireless.asset b/data/assets/util/joysticks/xbox-wireless.asset index 75955c4294..239edbeb88 100644 --- a/data/assets/util/joysticks/xbox-wireless.asset +++ b/data/assets/util/joysticks/xbox-wireless.asset @@ -50,12 +50,14 @@ asset.onInitialize(function() local controller = XBoxController; local name = "Wireless Xbox Controller"; - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, 0.05) - openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, 0.05) + local deadzoneJoysticks = 0.15 + local deadzoneTriggers = 0.05 + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, deadzoneTriggers) + openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, deadzoneTriggers) openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X"); openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true); diff --git a/data/assets/util/joysticks/xbox.asset b/data/assets/util/joysticks/xbox.asset index c94449ba68..1bc5314d4d 100644 --- a/data/assets/util/joysticks/xbox.asset +++ b/data/assets/util/joysticks/xbox.asset @@ -50,12 +50,14 @@ asset.onInitialize(function() local controller = XBoxController; local name = "Xbox Controller"; - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], 0.15) - openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, 0.05) - openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, 0.05) + local deadzoneJoysticks = 0.15 + local deadzoneTriggers = 0.05 + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.LeftThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[1], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.RightThumbStick[2], deadzoneJoysticks) + openspace.navigation.setAxisDeadZone(name, controller.LeftTrigger, deadzoneTriggers) + openspace.navigation.setAxisDeadZone(name, controller.RightTrigger, deadzoneTriggers) openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[1], "Orbit X"); openspace.navigation.bindJoystickAxis(name, controller.LeftThumbStick[2], "Orbit Y", true);