Skip to content

Commit

Permalink
InputManager: Further workarounds for SteamVR Input bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Oct 9, 2018
1 parent d835e03 commit b31240f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Revive/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,15 @@ bool InputManager::OculusTouch::GetInputState(ovrSession session, ovrInputState*
touches |= ovrTouch_RThumbUp;

// TODO: Should be handled with chords in SteamVR input
if (GetDigital(m_Button_HandTrigger) && !GetDigital(m_Touch_IndexTrigger))
// FIXME: Can't use IsReleased or IsPressed, because bChanged resets after every call to GetDigitalActionData
vr::InputDigitalActionData_t triggerData = {};
vr::VRInput()->GetDigitalActionData(m_Button_HandTrigger, &triggerData, sizeof(triggerData));
if (triggerData.bState && !GetDigital(m_Touch_IndexTrigger))
touches |= ovrTouch_RIndexPointing;

inputState->Buttons |= (hand == ovrHand_Left) ? buttons << 8 : buttons;
inputState->Touches |= (hand == ovrHand_Left) ? touches << 8 : touches;


// FIXME: Can't use IsReleased or IsPressed, because bChanged resets after every call to GetDigitalActionData
vr::InputDigitalActionData_t recenterData = {};
vr::VRInput()->GetDigitalActionData(m_Recenter_Thumb, &recenterData, sizeof(recenterData));
Expand All @@ -468,9 +470,6 @@ bool InputManager::OculusTouch::GetInputState(ovrSession session, ovrInputState*

if (settings->ToggleGrip == revGrip_Hybrid)
{
// FIXME: Can't use IsReleased or IsPressed, because bChanged resets after every call to GetDigitalActionData
vr::InputDigitalActionData_t triggerData = {};
vr::VRInput()->GetDigitalActionData(m_Button_HandTrigger, &triggerData, sizeof(triggerData));
if (triggerData.bChanged)
{
if (triggerData.bState)
Expand All @@ -493,7 +492,7 @@ bool InputManager::OculusTouch::GetInputState(ovrSession session, ovrInputState*
}
else if (settings->ToggleGrip == revGrip_Toggle)
{
if (IsPressed(m_Button_HandTrigger))
if (triggerData.bChanged && triggerData.bState)
WasGripped = !WasGripped;
}
else
Expand Down

0 comments on commit b31240f

Please sign in to comment.