Search Unity

Question [QUEST2/ALT] Code-based hand controller positioning without original headset cameras

Discussion in 'VR' started by PascalTheDog, May 6, 2022.

  1. PascalTheDog

    PascalTheDog

    Joined:
    Mar 16, 2015
    Posts:
    86
    Hey,

    We're VR developers using Oculus Quest 2 headsets for shared-room apps and we've just started experimenting with Antilatency hardware. Basically, it's a tracking camera that takes over the headset's positioning capabilities and uses special flooring for accurate and stable roomscale positioning.

    We still use the Quest 2 controllers for hand positioning and controls, though — and AFAIK the Antilatency tracker can't detect those. So we have to devise a way to make sure hands are accurately positioned without relying on camera-based detection.

    I've tried fiddling with the TryGetFeatureValue method of the InputDevice class in the XR namespace... but I never quite get the result I'm looking for. How exactly does that method work when it comes to positioning the devices? Is it even possible to achieve what I'm looking for?

    Here's a code snippet of the script-based hand positioning. This works with a vanilla headset, but not with the Antilatency tracker equipped.

    Code (CSharp):
    1.  
    2. private void Awake()
    3.     {
    4.         leftController = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
    5.         rightController = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
    6.     }
    7.  
    8.     private void Update()
    9.     {
    10.             MapPosition(leftHand, leftController);
    11.             MapPosition(rightHand, rightController);
    12.     }
    13.  
    14.     private void MapPosition(Transform target, InputDevice device)
    15.     {
    16.         device.TryGetFeatureValue(CommonUsages.devicePosition, out Vector3 position);
    17.         device.TryGetFeatureValue(CommonUsages.deviceRotation, out Quaternion rotation);
    18.  
    19.         target.SetPositionAndRotation(position, rotation);
    20.     }
    21.  
    Assistance would be greatly appreciated. Cheers!