- Home /
 
Trigger action on one controller makes other controller disappear
I am using and Oculus Quest2 with the hand controllers. I want the trigger pull on one controller to make the other controller disappear until the trigger is released. Any advice on how to get this to work?
Answer by rh_galaxy · Apr 27 at 11:26 PM
You can get the trigger values like this
 UnityEngine.XR.InputDevice handRDevice = 
     InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
 UnityEngine.XR.InputDevice handLDevice = 
     InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
 handRDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.trigger,
     out float triggerR);
 handLDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.trigger,
     out float triggerL);
 //if(triggerR > 0.5f) R trigger pressed
 //if(triggerL > 0.5f) L trigger pressed
 
               Then you can do SetActive() on the controller gameObjects, but without code and without a picture of your controller game objects in the inspector you can't get help with that.
Your answer
 
             Follow this Question
Related Questions
How do i make my script count once an animation on another script has finished? 1 Answer
OpenGL Errors With Single-Pass Deferred Rendering on Oculus Quest 0 Answers
Multiple Quests in Unity? 1 Answer
BCE0004: Ambiguous reference 'Quest': Quest, Quest. 0 Answers
How do I access music files on the Oculus Quest and play them? 0 Answers