How do i get Oculus quest input?

Hello,
I am trying to activate the trigger button in oculus quest with Unity 2020 but doesn’t work, this is my code

    InputDevice leftHandDevice;

    private void Start()
    {
        leftHandDevice = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
    }

    private void Update()
    {
        bool triggerValue;
        if (leftHandDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.triggerButton, out triggerValue) && triggerValue)
        {
            Debug.Log("Trigger button is pressed.");
        }
    }

I have already solved, i had to use the inputdevice variable of the XR controller

1 Like