In Unity VR development, getting a scene to appear in a headset is only the first step. Drawing on Zenva’s experience teaching coding and game development across more than 400 courses, this tutorial shows you how to set up headset and controller tracking, add direct and ray interactions, and configure locomotion with the XR Interaction Toolkit. You’ll use a kitchen scene to build and test each skill.
This tutorial assumes you have Unity installed and a working VR headset connected to your computer.
Download Project Files
The Virtual Reality Mini-Degree – Unity Edition includes Intro to VR with Unity’s XR Interaction Toolkit, with downloadable assets and a completed project. Have the kitchen models, materials, skybox, and water particle prefab on hand to follow the steps below.
Project Setup for Unity VR Development
Organizing the Project
Start with an empty Unity project created from the Universal Render Pipeline (URP) template. In the Project window, remove the Tutorial Info folder and Readme asset, then move the Input Actions asset into Settings.

Importing the 3D Assets
Extract assets.zip and drag the asset folders into Unity’s Project window. The archive includes an asset license file. Once Unity finishes importing, select Wood in the Materials folder and check that it uses the URP Lit shader with both a base map and a normal map assigned.

Building the Scene
Drag the circular platform from Models into the scene, apply the Tiles material, and set its position to (0, 0, 0). Create an empty GameObject named _environment at the same position. Parent the platform, Directional Light, and Global Volume to it.
Drag in the Kitchen model. Set its Y rotation to -90 and its Z position to 1 to place it just behind the platform. Keep it outside _environment: you’ll add colliders and interactions to it later.

Assigning Materials Efficiently
Select the kitchen model in the Project window and open its Materials tab. Use the slot pickers to assign dark wood to the wood slot, metal to the metal slot, marble to the marble slot, and light wood to the chopping board. Click Apply to update the model. Do the same for other models, such as assigning metal and wood to the knife. Leave the watermelon’s materials until you add it to the scene.

Improving the Visuals With a New Skybox
Open Window > Rendering > Lighting and select the Environment tab. Drag the cube map material from Assets > Skybox into Skybox Material. If the metal sink’s reflections don’t match the new sky, add a reflection probe.

Adding a Reflection Probe
In the Hierarchy, choose Light > Reflection Probe. Start at (0, 0, 0) and raise the probe a little so it can capture the scene. Set Type to Baked, leave the resolution at 128, and click Bake. A baked probe captures the environment once for reflective surfaces like the sink and tap instead of updating continuously. Parent it to _environment to keep the Hierarchy tidy.


Installing XR Interaction Toolkit
Opening the Package Manager
Go to Window > Package Management > Package Manager and select Unity Registry. You can find the XR Interaction Toolkit there, but for this setup, install it through the VR feature set rather than on its own.

Installing the VR Feature Set
Under Features, select VR and click Install. It bundles the XR Interaction Toolkit for interactions, the Oculus XR Plugin for Oculus and Meta Quest, and the OpenXR Plugin for a wider range of headsets.

Handling Project Validation
If Project Validation flags Run In Background, click Fix. This lets the camera keep tracking when the app loses focus, such as when the headset’s system menu opens. Use Fix All if you have several issues to resolve.

Importing the Starter Assets
In Package Manager, select XR Interaction Toolkit and open Samples. Import Starter Assets, which supplies controller models and input actions you’ll use later. If Project Validation asks you to set interaction layer 31 to Teleport, click Fix.


Positioning the Camera
In the Scene view, move the Main Camera near the kitchen sink, roughly where the player’s head will be.

Configuring XR Plug-in Management
Open Edit > Project Settings > XR Plug-in Management. Enable Oculus for an Oculus or Meta Quest headset, or OpenXR for most other headsets. The project can enable both if it targets multiple headsets. Restart the editor when prompted.

Final Performance Tweaks
Return to Project Validation after the restart. If it recommends disabling Screen Space Ambient Occlusion, go to Assets > Settings, select the renderer asset used by the project (PC_Renderer in this example), and turn off that renderer feature. It adds shadows where surfaces meet, but costs performance in VR.


Testing the Setup
Press Play with your headset connected. You should see the kitchen, but the view will stay static when you move your head. That’s what the tracked camera will fix.

XR Rig – Part 1
Adding a Tracked Pose Driver to the Camera
On the Main Camera, add Tracked Pose Driver (Input System), not the version for the older input system. Set Tracking Type to Rotation And Position and leave the update type at its default.



Binding the Headset Inputs
Under Position Input, click the plus icon and select Add Binding. Open the new binding and, under Path, choose XR HMD > center eye position. Use the same process to bind Rotation Input to the XR HMD device rotation and Tracking State Input to the XR HMD tracking state. Press Play and check that your view follows both head movement and rotation.



Creating an XR Rig
Create an empty GameObject named XR Origin at (0, 0, 0). Make Main Camera its child, reset the camera’s position, and raise it to about the player’s standing height. The rig gives you one parent for the camera, hands, and other player components.

Tracking the Hand Controllers
Under XR Origin, create an empty Left Hand GameObject and add Tracked Pose Driver (Input System). Bind its position, rotation, and tracking state inputs to the matching device position, device rotation, and tracking state under XR Controller > Left Hand.

Adding a Visual Hand Model
Add a sphere under Left Hand and name it Hand Model. Scale it to around 0.1 and remove or disable its Sphere Collider so it won’t trigger interactions yet. In Play mode, it should follow the left controller.


Fixing the Near Clipping Plane
If the sphere disappears close to your face, select Main Camera and change Clipping Planes > Near from 0.3 to 0.01. This lets the camera draw objects closer to you.


Challenge
Try repeating the left-hand setup for the right controller before checking your work in the next section.
XR Rig – Part 2
Creating the Right-Hand Controller
Create an empty Right Hand under XR Origin. Use a child cube to distinguish it from the left-hand sphere. Scale the cube to 0.1 on each axis and remove its Box Collider.


Configuring the Tracked Pose Driver
On Right Hand, add the Input System version of the Tracked Pose Driver. Bind position, rotation, and tracking state the same way as for the left hand, but use the XR Controller > Right Hand device paths.


Testing the Hands
Press Play with the headset and controllers connected. Check that the sphere follows the left controller and the cube follows the right.

Finalizing the Rig With the XR Origin Component
Add the XR Origin component to the XR Origin root. Its origin base GameObject is already assigned. Next, give it a camera and a floor offset reference.

Setting Up the Camera Offset
Create an empty Camera Offset under the rig and give it a Y position of 1.35. Parent Main Camera to it and reset the camera’s local position to zero. On the XR Origin component, assign Camera Offset to Camera Floor Offset GameObject and Main Camera to Camera.

Configuring Tracking and Camera Height
Leave Tracking Origin Mode set to Not Specified so the connected headset can use its default. Set Camera Y Offset to 1.35 as a default standing height when floor tracking is unavailable. If you want to reuse the rig, save the finished XR Origin GameObject as a prefab.

Grab Interactables – Part 1
Setting Up the Interactable Object
Create an empty Pot GameObject, then drag in the pot mesh, rename it Model, and parent it to Pot. Set the child’s local position to (0, 0, 0) and position the parent on the counter. This separates the visual model from the interaction components you’ll add to the parent.

Adding Colliders and Physics
On Model, use two Box Colliders: one around the pot’s body and one around its handle. If you choose a Mesh Collider instead, enable Convex so it can work with the Rigidbody. Add a Rigidbody to Pot and check Is Kinematic for now so it won’t fall before you add colliders to the room.


Making the Object Grabbable
Add XR Grab Interactable to Pot. In the Hierarchy, choose XR > Interaction Manager to create the scene’s single manager. It connects the pot, which is the interactable, to the hands, which will be the interactors. The manager and the model’s child colliders are found automatically; leave the interaction layer at Default.

Adding a Direct Interactor to the Hand
Right-click Left Hand and choose XR > Direct Interactor. Set the child object’s local position to (0, 0, 0). The Sphere Collider defines the reach of the grab; the XR Direct Interactor handles the interaction. Set its Handedness to Left.


Connecting the Controller Inputs
In the action picker, search for XRI Left. Assign XRI Left Interaction/Select and Select Value to the corresponding select inputs. Assign XRI Left Interaction/Activate and Activate Value to the activate inputs. Select picks up the object; activate can trigger an action on something you’re already holding. The value actions report how far the trigger is squeezed on a scale from 0 to 1.

Enabling the Inputs
Add an Input Action Manager to XR Origin. In its Action Assets list, add XRI Default Input Actions so that the controller bindings can fire.

Testing and Next Steps
In Play mode, move your left hand over the pot and pull the trigger. You can hold and move it, but it hangs in the air when released because it’s still kinematic. It also attaches at its base instead of the handle. You’ll change the grip point next.

Grab Interactables – Part 2
Setting Up the Right-Hand Interactor
Add another Direct Interactor under Right Hand at local position (0, 0, 0) and set Handedness to Right. Assign the Select, Select Value, Activate, and Activate Value actions from XRI Right Interaction. Test that you can pick up the pot with either hand and pass it from one to the other.


Controlling Where an Object Is Held
When Attach Transform is set to None, the grab falls back to the object’s own origin. On the pot, that’s at the bottom. An attach transform lets you set both the position and rotation of the grip.

Using a Fixed Attach Point
Create an empty child of Pot called AttachTransform. Move it to the handle and set its Y rotation to -90. Assign it to Attach Transform on the XR Grab Interactable. Now the pot snaps to the handle grip, no matter where you first touch it.

Using a Dynamic Attach Point
Try turning on Use Dynamic Attach. The pot now attaches based on your hand’s position and rotation at the moment you grab it. Turn it off again so that the pot keeps its fixed handle grip.

Creating a Watermelon That Grabs From Anywhere
Create a Watermelon parent with the watermelon mesh as a child named Model. Assign its material in the child’s Mesh Renderer and add a Mesh Collider with Convex enabled. On the parent, add a kinematic Rigidbody and an XR Grab Interactable with Use Dynamic Attach checked. In Play mode, compare the watermelon’s grab point with the pot’s fixed grip.



What’s Next
Both objects can be grabbed, but they’re still kinematic. Before turning on physics, give the kitchen surfaces colliders so dropped objects have somewhere to land.
Physical Environment
Making the Ground Solid
Add a Mesh Collider to the floor platform so falling objects can land on it.

Adding Colliders to the Kitchen
Expand Kitchen in the Hierarchy and add colliders to the relevant parts. Use a Mesh Collider for the countertop and leave Convex off so the static surface retains its shape. A Box Collider is enough for the chopping board. Use Mesh Colliders for the cabinet base, faucet, and sink, and add a collider to the faucet handle.


Enabling Physics on Objects
Clear Is Kinematic on the pot and watermelon Rigidbodies. Now gravity and other forces can move both objects.

Testing the Interactions
In Play mode, pick up the pot and drop it into the sink. Try throwing the watermelon and watch it roll across the surfaces. If both objects collide with the kitchen instead of falling through it, you’re ready to try grabbing them from farther away.

Ray Interactor
A Direct Interactor needs your hand to reach the object’s collider. A Ray Interactor lets you point and select from farther away.

Adding a Ray Interactor
Right-click Left Hand and choose XR > Ray Interactor. The XR Ray Interactor handles interaction, the Line Renderer draws the pointer, and XR Interactor Line Visual controls its shape and colors. The Sorting Group controls how the ray is drawn over the scene. In Play mode, the ray can already indicate when it’s hovering over the pot, but the trigger won’t select it until you bind the inputs.


Configuring the Interactor Inputs
Set Handedness to Left and disable UI interaction for this scene. With Manipulate Attach Transform enabled, assign XRI Left Interaction/Translate Manipulation to Translate Input and the corresponding left-hand Rotate Manipulation action to Rotate Input. Leave the directional and scale options unchanged. Under Input Configuration, assign the same left-hand select, select value, activate, and activate value actions you used for direct grabbing.
Point at the watermelon and pull the trigger. Use the joystick to push it away, pull it closer, or rotate it. The pot still uses its fixed handle grip, while the watermelon attaches where the ray hits it.



Using Force Grab
Enable Force Grab on the XR Ray Interactor to make objects snap to the controller’s attach point when selected. Keep Manipulate Attach Transform on if you still want joystick control after the grab.

Customizing the Ray’s Appearance
In XR Interactor Line Visual, try a Width of 0.008 and taper the end with the Width Curve. Set both nodes of the invalid color gradient to light blue and set the valid color gradient to green. Leave the blocked gradient yellow if you want a separate signal for an obstructed interaction. Test the ray in Play mode: it should turn from blue to green when you hover over the pot.



Challenge
Repeat the Ray Interactor setup on the right controller so either hand can reach objects from a distance.
Faucet Interaction
The faucet needs to respond to selection without being picked up. Here, selecting it will rotate the handle and toggle a particle effect.

Creating the Interactable Object
Create an empty Faucet Interaction GameObject and add a Box Collider. Start with a size of 0.1 on each axis and adjust the collider from the side view until it fits the handle.

Using the XR Simple Interactable
Add XR Simple Interactable to Faucet Interaction and drag the Box Collider into its Colliders list. Unlike a grab interactable, this component can respond to a selection event without attaching the object to your hand. You’ll wire up Select Entered after writing the script.

Preparing the Water Particle Effect
Drag the prefab from the Water Particle folder into the scene and position it below the spout. Disable Play On Awake so the water doesn’t start running when the scene loads.

Scripting the Faucet Logic
In Assets, create a Scripts folder and a script named Faucet. Attach it to Faucet Interaction and open it in Visual Studio. Replace the default methods with the class structure below. The boolean tracks whether the tap is on, and the serialized fields let you assign the handle, rotations, and particle effect in the Inspector.
using UnityEngine;
public class Faucet : MonoBehaviour
{
private bool isOn;
[SerializeField]
private Transform tapObject;
[SerializeField]
private Vector3 offRotation;
[SerializeField]
private Vector3 onRotation;
[SerializeField]
private ParticleSystem waterParticle;
}Inside the Faucet class, add TurnOff and TurnOn. Each method updates the state, stops or plays the particles, and sets the handle’s local rotation.
void TurnOff ()
{
isOn = false;
waterParticle.Stop();
tapObject.localEulerAngles = offRotation;
}
void TurnOn ()
{
isOn = true;
waterParticle.Play();
tapObject.localEulerAngles = onRotation;
}Add the public Toggle method inside the same class. It calls the appropriate method based on the current state.
public void Toggle ()
{
if(isOn)
TurnOff();
else
TurnOn();
}Finally, add Start so the faucet is off when the scene starts.
void Start ()
{
TurnOff();
}Connecting Components in the Inspector
On the Faucet component, assign the handle model to Tap Object and the particle effect to Water Particle. Set Off Rotation to (0, 0, 0) and On Rotation to (0, 0, 40). In the XR Simple Interactable events, add a listener under Select Entered, drag in the Faucet component, and choose Faucet > Toggle().


Testing the Interaction in VR
Point at the faucet until the ray turns green. Pull the grip trigger and check that the handle rotates and the water starts. Select it again to stop the water and return the handle to its starting position.


Locomotion
Adding a Character Controller
Add a Character Controller to XR Origin so the rig can move and collide with the floor and furniture. Use a small radius, set the height to about 1.35, and set Center Y to half that height, about 0.675. That puts the capsule’s bottom at the rig’s origin.


Setting Up the Locomotion System
Under XR Origin, create an empty child named Locomotion and add a Locomotion Mediator. The setup normally finds the XR Origin and Character Controller automatically. Check Use Character Controller so movement respects the capsule. The Mediator and accompanying XR Body Transformer still need providers to move or turn the rig.

Implementing Continuous Movement
Create an empty Move child under Locomotion and add the non-deprecated Continuous Move Provider. Assign Locomotion to Mediator. Leave the movement options at their defaults, including a Move Speed of 1 meter per second and an In Air Control Modifier of 50%. Enable Strafe controls sideways movement, while Enable Fly allows free movement in three dimensions.
Set Forward Source to Main Camera, not Camera Offset, so forward follows the player’s view. Assign XRI Left Locomotion/Move to Left Hand Move Input and leave Right Hand Move Input empty. Make sure gravity is enabled, then test the left joystick while looking in different directions.




Adding the Ability to Turn
Create an empty Turn child under Locomotion. Add both a Snap Turn Provider and a Continuous Turn Provider. Assign Locomotion to both Mediator fields, but enable only one provider at a time.

Configuring Snap Turn
Leave the Turn Amount at 45 degrees and assign XRI Right Locomotion/Snap Turn to Right Hand Turn Input. In Play mode, the right joystick now rotates your view in fixed steps.

Configuring Continuous Turn
On the Continuous Turn Provider, try a Turn Speed of 60 degrees per second and assign XRI Right Locomotion/Turn to Right Hand Turn Input. Disable the snap provider before enabling the continuous provider. Test again to compare the smooth turn with the fixed steps.

A Note on VR Comfort
Smooth turning can cause motion sickness for some players. Snap turning is one option you can offer instead. Another comfort technique is a vignette that narrows the field of view during movement.
Test Your VR Kitchen
You now have a kitchen scene you can move around and interact with in VR. Run through the pieces together in Play mode:
- Move your head and both controllers to check that the camera and hands track correctly.
- Grab the pot by its fixed handle point and the watermelon by a dynamic point, then release them to test the kitchen colliders.
- Use the ray to grab an object at a distance and select the faucet to turn the water on and off.
- Move with the left joystick and compare snap turning with continuous turning on the right.
Once the scene works end to end, decide which turning style you want as the default for your project.
For more guided practice building VR projects in Unity, continue with Zenva’s Virtual Reality Mini-Degree – Unity Edition.
Did you come across any errors in this tutorial? Please let us know by completing this form and we’ll look into it!

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.







