Made With Unity | Unity VR Part 5: XR Simple Interactable

Made With Unity | Unity VR Part 5: XR Simple Interactable

·

1 min read

The XR Simple Interactable on the XR Interaction Toolkit is the simplest version to interact with a object, we are going to use it to interact with a simple “Button”.

BUTTON

On the scene I have a object called ButtonFrame, that has a Rigidbody component, a Box Collider and a custom script called ButtonBehavior. Has a child object I have another game object called Button that has a Mesh Collider component with Convex and Is Triger check.

The Button object is the one with the XR Simple Interactable script and is Interaction Layer Mask is Button. The Hover event will called the public method from the ButtonBehaviour script when you touch the Button.

XR Origin / Player

Make sure both on your hands, LeftHand Controller and RightHand Controller, have the XR Direct Interact component and the appropriate Interaction Layer Mask is selected, remember that the Button object has the Interaction Layer Mask as Button

Also check that the collider from your hands is Trigger is checked.

Press Play

🎮PART 6🎮