XR Controller and XR Grab Interactable in VR - Unity3d

 

XR Controller + XR Grab Interactable


In XR Rig, we have 2 controllers each with an XR controller script.

Taking a more detailed look at the input section provided by the XR controller script, we can see that there are 3 sections: Select, Activate, UI Press. Within these sections, we can choose which button activates these usages. We'll keep it as it is right here and see how we can use these triggers to activate other things.



Next on our XR Grab Interactable object, we have a setting called Interactable Events. Here we have a list of interactable events with our XR controller. For example, we had our activate usage set to trigger, therefore when we grab onto the XR grab interactable and press the trigger button, under the on activate we can run a script function that displays the flashlight white light or not. 

Other interactions with the object can include on hover, change the color of the flashlight to show that you can grab it. On select change the color so you can interact with it. etc. 

This is a simple way to control button presses with an XR grab interactable.