I enabled in Unity the OpenXR VR mode.
Then I enabled the HTC Vive interaction profile and others
After that I can see the world and I can get the Hand positions of the HTC Vive controller, but I can not get any input, How can I get for example the Trigger button press event?
I am using the following code:
private UnityEngine.XR.InputDevice inputDevice;
public bool isIndexTriggerPressed()
{
bool triggerValue = false;
inputDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.triggerButton, out triggerValue);
if ((!previousIndexTriggerPressed) && (triggerValue))
{
previousIndexTriggerPressed = triggerValue;
return true;
}
previousIndexTriggerPressed = triggerValue;
return false;
}
Is this the right code?, How can I get the trigger press event?