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

Vive controller input frequently broken when also playing with trackers

Discussion in 'AR/VR (XR) Discussion' started by OpaqueMegane, Sep 18, 2018.

  1. OpaqueMegane

    OpaqueMegane

    Joined:
    May 24, 2018
    Posts:
    1
    Hello,

    I'm working on a project with the Vive Pro that uses the 2 controllers, plus 3 vive trackers to drive a humanoid character. Since upgrading to Unity 2018.2.8, getting button/trigger input from the controllers only works intermittently, and often only on one of the controllers. I have tried both beta, and non-beta steamvr. I've tried getting input a few different ways, using the Unit input manager with the various joystick axes described in this link (https://docs.unity3d.com/Manual//OpenVRControllers.html),

    I've also tried going through SteamVR as below.


    Code (CSharp):
    1.  
    2.     bool TriggerCheckForViveInput(bool leftHand, Valve.VR.EVRButtonId button)
    3.     {
    4.         if (SteamVR.instance == null)
    5.         {
    6.             return false;
    7.         }
    8.  
    9.         Valve.VR.ETrackedControllerRole handRole = leftHand ? Valve.VR.ETrackedControllerRole.LeftHand : Valve.VR.ETrackedControllerRole.RightHand;
    10.  
    11.        
    12.         int viveControllerIdx = (int)SteamVR.instance.hmd.GetTrackedDeviceIndexForControllerRole(handRole);
    13.  
    14.         if (viveControllerIdx < 0 || !SteamVR.instance.hmd.IsTrackedDeviceConnected((uint)viveControllerIdx))
    15.         {
    16.             return false;
    17.         }
    18.  
    19.         return SteamVR_Controller.Input((int)viveControllerIdx).GetPress(button);
    20.     }
    21.  
    These have worked for me in the past, and I've tried rebooting, reinstalling, re-paring, and various things to no avail.

    When I put on the headset with no other software running, I can see the triggers/button/trackpad all working in the steamVR default view, so it's not a harware issue.

    I don't know if it's relevant, but it seems like my tracking has gotten unusually jittery, and steamVR when launching often has trouble finding the headset. I've tried with 2 different headsets, and pairs of controllers so it's not a hardware issue.

    Has anyone else had this issue?
     
  2. joepl

    joepl

    Unity Technologies

    Joined:
    Jul 6, 2017
    Posts:
    87
    I'm not sure about the SteamVR issue when using the SteamVR plugin. Have you tried posting in the SteamVR forums. I did notice that the behavior changed recently for hardware trackers. They now can come through as left/right controllers depending on how they are recognized from lighthouses unless you switch out of handed mode in the in-headset setting.

    Can you post the code you are using for the Unity input manager. I can try to repro here.

    Thanks.