Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug [OpenXR] Detecting Vive Tracker connection after launching the app.

Discussion in 'VR' started by CBHM, Mar 29, 2023.

  1. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    33
    Hi, I am having an issue where the HTC Vive Trackers are not detected by the app if they are connected after launching the app.
    The app detects the tracker's connection / re-connection if they are connected before launching the app.
    Is this a known issue/ Is any workaround available for this?

    Could it be possible to intercept the OpenXR calls and somehow register the trackers by creating a custom feature?

    I am using ViveTrackerProfile found here: https://forum.unity.com/threads/openxr-and-openvr-together.1113136/#post-7803057.

    OpenXR runtime SteamVR
    OpenXR plugin 1.4.2
    Unity 2020.3.35f1
    XR plugin management 4.2.0

    Thank you!
     
  2. Deltigre

    Deltigre

    Unity Technologies

    Joined:
    Sep 13, 2022
    Posts:
    37
  3. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    33
    Hi @Deltigre, thank you for pointing that out!
    could it be possible to provide some information/ or guide us in the direction of how can we detect the device connection and register it?
    Any help will be appreciated, Thank you!
     
  4. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    33
    I have noticed that when the trackers are connected before launching the app, MakeCurrent() gets called from InputSystem.NativeInputSystem.NotifyUpdate() and the device works, but when it gets connected after the launch I didn't receive the call to MakeCurrent(). So I was thinking if I can get the InputDevice and call MakeCurrent manually, will that be the correct way to do it? also, I have tried to get a callback from OnDeviceChange when the tracker gets actually connected, but I don't receive any event, How can I get a callback from Unity that an InputDevice is connected?
     
  5. nicoco007

    nicoco007

    Joined:
    Oct 30, 2017
    Posts:
    1
    I'd also be interested in any progress regarding this issue. From what I've gathered, the event triggered when a tracker is connected is either XR_TYPE_EVENT_DATA_VIVE_TRACKER_CONNECTED_HTCX or XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED. Unfortunately, neither of these are sent to OpenXRFeature's ReceiveNativeEvent, so I don't think there's currently any way to know when a tracker is connected/disconnected on the managed side. Either way, I'm not sure there's currently even a way to nicely refresh things on the managed side – the only way I successfully got new trackers to be recognized while the game is running is to fully deinitialize and reinitialize OpenXRLoader (which obviously is far from ideal).

    My current guess is that actions are bound once internally by Internal_AttachActionSets and then, since it can't be called again once the loader is started, actions won't bind to the newly connected trackers until the entire thing shuts down and starts over again, and calls AttachActionSets during the process. I have no idea what's happening on the native side though so some clarification on this would be nice!
     
    chiranjiv likes this.