Skip to content

Commit

Permalink
fix(SDK): ensure oculus touch uses correct controller for button press
Browse files Browse the repository at this point in the history
The Oculus controller SDK was returning the same controller type for
both button presses, meaning the left controller (or index 0) was
initiating button presses on both controllers.

This has been fixed now by also checking for the generic `Touch`
controller type and using the given index to determine which
touch controller is being used.
  • Loading branch information
thestonefox committed Jul 21, 2017
1 parent ab68213 commit d5adf01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Assets/VRTK/SDK/Oculus/SDK_OculusController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ protected virtual bool IsButtonPressed(uint index, ButtonPressTypes type, OVRInp
VRTK_TrackedController device = GetTrackedObject(GetControllerByIndex(index));
if (device != null)
{
OVRInput.Controller controllerMask = GetControllerMask(device.index);
OVRInput.Controller controllerMask = GetControllerMask(index);
switch (type)
{
case ButtonPressTypes.Press:
Expand All @@ -739,7 +739,7 @@ protected virtual bool IsButtonPressed(uint index, ButtonPressTypes type, OVRInp
VRTK_TrackedController device = GetTrackedObject(GetControllerByIndex(index));
if (device != null)
{
OVRInput.Controller controllerMask = GetControllerMask(device.index);
OVRInput.Controller controllerMask = GetControllerMask(index);
switch (type)
{
case ButtonPressTypes.Touch:
Expand All @@ -760,6 +760,8 @@ protected virtual OVRInput.Controller GetControllerMask(uint index)

switch (activeControllerType)
{
case OVRInput.Controller.Touch:
return (index == 0 ? OVRInput.Controller.LTouch : (index == 1 ? OVRInput.Controller.RTouch : OVRInput.Controller.None));
case OVRInput.Controller.LTouch:
return (index == 0 ? OVRInput.Controller.LTouch : OVRInput.Controller.None);
case OVRInput.Controller.RTouch:
Expand Down

0 comments on commit d5adf01

Please sign in to comment.