Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OpenVR Device management Broken using native Unity XR

Discussion in 'AR/VR (XR) Discussion' started by OllieCJ, Oct 10, 2018.

  1. OllieCJ

    OllieCJ

    Joined:
    Aug 2, 2017
    Posts:
    8
    Hi Unity users,

    I appear to be having a problem with device management using 2 Vive controllers and a Vive tracker. Depending on the order in which they are turned on and off they are incorrectly allocated XRNodes

    If a Controller is turned on followed by a HardwareTracker, the tracker will be swapped in as the second (Left) controller. If a tracker is switched on on it's own, it will register fine as a tracker. However, if a controller is then turned on, the Tracker will be assigned one of the Hand nodes and the controller the other. Below are some demonstrations of this:


    Tracker only


    Then controller turned on.

    There are numerous permutations of this, essentially if both controllers are turned on first then the tracker, it works fine. However, if one is then switched off all number of reallocations can happen with little apparent logic. If unity is launched with all 3 devices on then allocation is seemingly random.

    This switch occurs upon successful tracking, after powering on. It seems to resemble behaviour from an older Steam Controller Manager script that was inherently broken when additional controllers and trackers were added. Here is my code for debugging:

    Code (CSharp):
    1. InputTracking.nodeAdded += NodeAdded;
    2.  
    3. private void NodeAdded(XRNodeState obj)
    4.         {
    5.             ulong id = obj.uniqueID;
    6.             Debug.Log("Object ID: " + id + ", connected as " + obj.nodeType);
    7. }
    8.  
    9. // Debugging Joystick allocations
    10. private void JoystickNames()
    11.         {
    12.             string[] joysticks = Input.GetJoystickNames();
    13.             int i = 0;
    14.             foreach (string s in joysticks)
    15.             {
    16.                 Debug.Log("Joystick at " + i + ": " + s);
    17.                 i++;
    18.             }
    19.         }
    20.