Skip to main content

Command Palette

Search for a command to run...

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

Published
1 min read
Made With Unity | Unity VR Part 5: XR Simple Interactable
R

I am a developer from Puerto Rico.

I develop games or applications with Unity C#. Constructing flexible and maintainable systems through event-driven designs that follow solid principles with a strong awareness for optimization and performance. With a focus to deliver complete and optimized experiences on mobile as well as PC and consoles. All my projects are saved using GitHub. Great at communicating and working in team environments. Love to learn new things and I am always looking for new opportunities.

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🎮

More from this blog

U

Untitled Publication

38 posts