Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

XRNode values are not updating their position

Discussion in 'VR' started by trzy, Jul 20, 2020.

  1. trzy

    trzy

    Joined:
    Jul 2, 2016
    Posts:
    128
    I am using XR Plugin Management with Oculus Quest and unable to read any XRNode values (left eye, right eye, device position, etc.)

    I have a minimalistic project that reproduces this problem with a single script (Test.cs) here: https://github.com/trzy/Quest-XRNode-Test

    Code (csharp):
    1.  
    2. void Update()
    3.   {
    4.     InputDevice device = InputDevices.GetDeviceAtXRNode(XRNode.Head);
    5.     if (!device.isValid)
    6.     {
    7.       Debug.Log("XR device is invalid");
    8.     }
    9.     if (device.TryGetFeatureValue(CommonUsages.devicePosition, out Vector3 devicePos))
    10.     {
    11.       Debug.LogFormat("DEVICE POS={0}", devicePos);
    12.     }
    13.     if (device.TryGetFeatureValue(CommonUsages.leftEyePosition, out Vector3 leftEyePos))
    14.     {
    15.       Debug.LogFormat("EYE POS={0}", leftEyePos);
    16.     }
    17.   }
    18.  
    The output of the values is always the same and clearly garbage:

    EYE POS=(0.0, 1.0, 0.0)

    Any help would be greatly appreciated!
     
    falsevaccume likes this.