Search Unity

Question Oculus Touch joystick not found?

Discussion in 'XR Interaction Toolkit and Input' started by sterlingm, Oct 26, 2020.

  1. sterlingm

    sterlingm

    Joined:
    Jul 14, 2017
    Posts:
    15
    I am trying to get the joystick information from an Oculus Rift S Touch controller. The joystick values seem to be returning zero when trying to access them from a script. Here is my short script to do this:

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.     public class JoyAxisReader : MonoBehaviour
    4.     {    
    5.         public string Name;
    6.    
    7.         public float Read()
    8.         {
    9.             Debug.Log("Name: " + Name + " Value: " + Input.GetAxis(Name));
    10.             return Input.GetAxis(Name);          
    11.         }
    12.     }
    13.  
    When I run my project, I get 0 for the Horizontal and Vertical axes. Here is a picture of the console:


    My Horizontal and Vertical axes are setup in the Input settings like this:



    However, the joystick values seem fine in the XR Interaction Debugger:



    What am I missing here? Am I supposed to set up the joystick in a different way than simply using the Input system for Unity? I have tried looking at the Oculus dev sites for Unity, but the controller information is about the key mappings. I am not concerned with button mappings right now - I just need to get joystick data.

    Any help is appreciated.
     
    Last edited: Oct 26, 2020
  2. sterlingm

    sterlingm

    Joined:
    Jul 14, 2017
    Posts:
    15
    The problem is using the RIGHT controller for this. The right controller is the secondary thumbstick. If I use the left controller it works fine.

    My new question is how can I change this? I can't seem to find anything about how to change which thumbstick is specified as primary or secondary, but I've been able to change which controller does what in games.