From 8d5b60a266482f740251def186a6c996946fef5c Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 14 Jul 2016 12:30:17 -0700 Subject: [PATCH] Simulate LTClick/RTClick for Oculus Touch and Hydra controllers --- interface/resources/controllers/hydra.json | 8 ++++++++ interface/resources/controllers/oculus_touch.json | 8 ++++++++ plugins/oculus/src/OculusControllerManager.cpp | 8 -------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/interface/resources/controllers/hydra.json b/interface/resources/controllers/hydra.json index 066676140c..716d283a86 100644 --- a/interface/resources/controllers/hydra.json +++ b/interface/resources/controllers/hydra.json @@ -3,9 +3,17 @@ "channels": [ { "from": "Hydra.LY", "filters": "invert", "to": "Standard.LY" }, { "from": "Hydra.LX", "to": "Standard.LX" }, + { "from": "Hydra.LT", "to": "Standard.LTClick", + "peek": true, + "filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ] + }, { "from": "Hydra.LT", "to": "Standard.LT" }, { "from": "Hydra.RY", "filters": "invert", "to": "Standard.RY" }, { "from": "Hydra.RX", "to": "Standard.RX" }, + { "from": "Hydra.RT", "to": "Standard.RTClick", + "peek": true, + "filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ] + }, { "from": "Hydra.RT", "to": "Standard.RT" }, { "from": "Hydra.LB", "to": "Standard.LB" }, diff --git a/interface/resources/controllers/oculus_touch.json b/interface/resources/controllers/oculus_touch.json index 3def439221..001d5b8716 100644 --- a/interface/resources/controllers/oculus_touch.json +++ b/interface/resources/controllers/oculus_touch.json @@ -8,6 +8,10 @@ { "from": "OculusTouch.LY", "filters": "invert", "to": "Standard.LY" }, { "from": "OculusTouch.LX", "to": "Standard.LX" }, + { "from": "OculusTouch.LT", "to": "Standard.LTClick", + "peek": true, + "filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ] + }, { "from": "OculusTouch.LT", "to": "Standard.LT" }, { "from": "OculusTouch.LS", "to": "Standard.LS" }, { "from": "OculusTouch.LeftGrip", "to": "Standard.LeftGrip" }, @@ -15,6 +19,10 @@ { "from": "OculusTouch.RY", "filters": "invert", "to": "Standard.RY" }, { "from": "OculusTouch.RX", "to": "Standard.RX" }, + { "from": "OculusTouch.RT", "to": "Standard.RTClick", + "peek": true, + "filters": [ { "type": "hysteresis", "min": 0.85, "max": 0.9 } ] + }, { "from": "OculusTouch.RT", "to": "Standard.RT" }, { "from": "OculusTouch.RS", "to": "Standard.RS" }, { "from": "OculusTouch.RightGrip", "to": "Standard.RightGrip" }, diff --git a/plugins/oculus/src/OculusControllerManager.cpp b/plugins/oculus/src/OculusControllerManager.cpp index 225ccf42b2..b3b1b20b2b 100644 --- a/plugins/oculus/src/OculusControllerManager.cpp +++ b/plugins/oculus/src/OculusControllerManager.cpp @@ -199,19 +199,11 @@ void OculusControllerManager::TouchDevice::update(float deltaTime, const control _axisStateMap[LX] = inputState.Thumbstick[ovrHand_Left].x; _axisStateMap[LY] = inputState.Thumbstick[ovrHand_Left].y; _axisStateMap[LT] = inputState.IndexTrigger[ovrHand_Left]; - // FIXME add hysteresis? Move to JSON config? - if (inputState.IndexTrigger[ovrHand_Left] > 0.9) { - _buttonPressedMap.insert(LT_CLICK); - } _axisStateMap[LEFT_GRIP] = inputState.HandTrigger[ovrHand_Left]; _axisStateMap[RX] = inputState.Thumbstick[ovrHand_Right].x; _axisStateMap[RY] = inputState.Thumbstick[ovrHand_Right].y; _axisStateMap[RT] = inputState.IndexTrigger[ovrHand_Right]; - // FIXME add hysteresis? Move to JSON config? - if (inputState.IndexTrigger[ovrHand_Right] > 0.9) { - _buttonPressedMap.insert(RT_CLICK); - } _axisStateMap[RIGHT_GRIP] = inputState.HandTrigger[ovrHand_Right]; // Buttons