Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity VR XR Toolkit - XR Direct Interactor vs XR Ray

Sep 1, 2022
About this tutorial

In this Unity VR XR Toolkit tutorial, I'll show how to set up an XR Direct Interactor controller vs an XR Ray Interactor. ► Art Assets - Polygon City - Low Poly https://bit.ly/3ScOYa1 My discord link ► https://discord.gg/DgUdNDT7KU ► Download Unity at https://unity.com Chapters: 00:00 Introductio

Written Guide

An XR Ray Interactor lets you point at a distant object and grab it. That's useful, but it isn't how hands work. The XR Direct Interactor requires your hand to physically occupy the same space as the object — which is what players expect in VR. This guide converts one hand from ray to direct so you can compare them side by side.

Step 1 — Keep one hand as a ray The setup starts with both hands using XR Ray Interactors. Leave the left hand controller alone and convert only the right. Having one of each running simultaneously is the fastest way to feel the difference between the two interaction models, and it's a legitimate shipping configuration too — many VR games use a ray for UI and distant selection and direct grabbing for nearby objects.

Step 2 — Strip the ray components off the right hand Select the right hand controller and remove three components: XR Ray Interactor, Line Renderer, and XR Interactor Line Visual. Remove them from the bottom up — the line visual first, then the line renderer, then the interactor — because the upper components depend on the lower ones and Unity will complain if you try to remove them out of order. You should be left with just the base XR Controller.

Step 3 — Add the direct interactor Add an XR Direct Interactor component. Enable Hide Controller On Select so the controller model disappears the moment you grab something — with your hand no longer drawn, attention goes to the object you're holding instead of a floating controller mesh clipping through it.

Step 4 — Add audio feedback The interactor exposes interactor events. On Select Entered, hook up a click audio clip so grabbing an object makes a sound. Without a visible hand model, audio does a lot of the work of confirming that a grab registered.

Step 5 — Add haptics Add a haptic event alongside the audio. You can fire haptics on hover entered as well as select, but firing only on select keeps the feedback meaningful rather than constant. Set haptic intensity to 0.2 and duration to 0.2 — a short, light pulse. Strong haptics on every grab get fatiguing fast.

Step 6 — Add a collider — this is the part that's easy to miss At this point nothing will grab, because a direct interactor detects objects through overlap and the hand has no collider to overlap with. Add a Sphere Collider to the controller and check Is Trigger. This is the single most common reason a direct interactor appears to do nothing.

Step 7 — Size the collider The default sphere collider is far too large — a hand-sized grab volume shouldn't be a meter across, or you'll pick up objects you never touched. Shrink it using the Edit Collider handles or, more precisely, by setting the radius directly. A radius of 0.1 approximates a hand well.

Step 8 — Test both hands In VR, the left hand still projects a ray and can select and grab at distance. The right hand has no ray at all and can't interact with anything until you physically reach into an object's space — at which point squeezing grabs it, the controller model vanishes, and you're holding the object directly. Two interaction models, running at once, doing different jobs.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →