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 Controllers not tracking in editor with OpenXR

Discussion in 'VR' started by Thomas-Mountainborn, Jul 2, 2021.

  1. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    New thread for the issue first discussed with @the_real_apoxol in the OpenXR mega thread.

    In my game Vermillion, running on Unity 2021.1.11f1, OpenXR 1.2.3, Input System 1.1.0-pre.5, some OpenXR/ hardware combinations don't have tracking controllers.

    Tracking in editor and in build:

    - OpenXR SteamVR with SteamVR hardware
    - Native Oculus

    Not tracking in editor, tracking in build:
    - OpenXR SteamVR with Oculus hardware
    - OpenXR Oculus
    - OpenXR WMR

    It is working properly in a new project with the same package settings. Vermillion started with 2019.4 with SteamVR and has been upgraded over 2020 to 2021.
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Have you sent me an editor log yet for one of the controllers that is not tracking in the editor?
     
  3. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Here is the editor log: https://pastebin.com/raw/uEVQXdA5

    These seem like interesting lines:

    [XR] [OpenXR Input]: [xrLocateSpace] Failed to locate view space relative to app space at time <59662880750225061> [ErrorCode: XR_ERROR_TIME_INVALID]
    [XR] [OpenXR Input]: [xrLocateSpace] Failed to locate space for ActionSet <oculustouchcontroller> Action <devicePose> SubPath </user/hand/left> at Time <> [ErrorCode: XR_ERROR_TIME_INVALID]
    [XR] [OpenXR Input]: [xrLocateSpace] Failed to locate space for ActionSet <oculustouchcontroller> Action <pointer> SubPath </user/hand/left> at Time <> [ErrorCode: XR_ERROR_TIME_INVALID]
    [XR] [OpenXR Input]: [xrLocateSpace] Failed to locate space for ActionSet <oculustouchcontroller> Action <devicePose> SubPath </user/hand/right> at Time <> [ErrorCode: XR_ERROR_TIME_INVALID]
    [XR] [OpenXR Input]: [xrLocateSpace] Failed to locate space for ActionSet <oculustouchcontroller> Action <pointer> SubPath </user/hand/right> at Time <> [ErrorCode: XR_ERROR_TIME_INVALID]
     
  4. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Those errors are actually pretty common on SteamVR, it happens when rendering stops for some reason, such as turning off head set. But can also happen on startup if there is some loading going on and the time between frames gets too large. If they continued to spam every frame then that would likely be the issue but a small number of them should be benign.

    I noticed the following in the logs, is this relevant to the issue at all?

    [App.Controllers.PlayerController] Left / right controller id not set.


    Otherwise I dont see anything in the log that would indicate an issue. If you open the input debugger, do you see data for the controllers, or the controllers at all?
     
  5. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    That's when I'm trying to get the correct ids for switching the player handedness by changing the input system usage of the controllers, it keeps trying until both controllers are tracked. It's not the cause of the issue here though, since it works fine in the build, and when using SteamVR hardware on OpenXR.

    The controllers are in there, yes. Can I see anything else in the input debugger?

    upload_2021-7-8_19-16-53.png
     
  6. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    If you double click on them it opens a window with the input
     
  7. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Yes, those values are actually updating.
     
  8. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    You know what, it is because of my PlayerController script! But not directly - the actual cause is that XRController.leftHand.devicePosition.ReadValue() returns an empty vector in the editor when using OpenXR (except when using SteamVR hardware).
     
  9. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Now thats odd... Are you able to reproduce that in a test project that you can report?
     
  10. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Sadly not, I was going to do just that but in the test project the values are filled in.
     
  11. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Is there any way in your real project that those actions are not getting enabled when in the editor? If you are unable to get it to reproduce in a test project then at some point the only option will be to report the bug with your real project. We usually prefer a smaller test project but occasionally there is no option but for users to send the real project for us to debug any further.

    When in the editor in the input debugger you should be able to also look at your actions and state on them as well, maybe see if anything jumps out there?
     
  12. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    The position and orientation actions are only filled in with an input source on one hand when using SteamVR + Oculus, whereas both are filled in when using Oculus native. All other actions do have a binding. However, none of the actions work, including the tracking on the one hand that does have an input source.
     
  13. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Have you tried reading the value out of an action rather than using XRController?
     
  14. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Those are all zero as well. Just tested the OpenXR package controller sample scene, and there the controllers are not tracking either, but the buttons, triggers and joysticks are.
     
  15. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    You tried it in a new project or just adding the scene into yours?
     
  16. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    Adding in my project. In a new project, the tracking does work when using SteamVR + Oculus.
     
  17. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Outside of sending your project in a bug report the only other thing I can think of is to copy over all of your project settings and the XR folder to the test project and see if that causes the same problem.
     
  18. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    502
    I tried it the other way around, and replaced the XR settings with those from the working project, since I saw that some of the scriptable assets in my XR settings had missing scripts. However, the issue remains. I'll see if I can reproduce the issue in a minimal copy of the project for a bug report.
     
  19. jarmohh

    jarmohh

    Joined:
    Dec 30, 2017
    Posts:
    12
    I just face this kind of problem (OpenXR). Hp reverb headset.

    List<InputDevice> inputDevices = new List<InputDevice>();
    InputDevices.GetDevices(inputDevices);

    I get devices if I build and run program, but if start in editor, no devices. After thinking I test this.

    void Start()
    {
    Invoke("StartListening", 8);
    ...

    void StartListening()
    {
    List<InputDevice> inputDevices = new List<InputDevice>();
    InputDevices.GetDevices(inputDevices);
    ...

    It works. Enough solution for me.
     
  20. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    I remember I had a similar problem with my early project. It takes a while for Unity to recognize input/action from your HMD and it's controllers when hitting play. And the fix for me was of somewhat the same as jarmohh had. I had to listen for the controllers and when Unity found them I assigned them to their respective places, or else it would just jank out and not recognize or report any values or feedback. Kinda annoying but that was my type of fix.