> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Using Motion Controllers in AR

In this demo, we'll make your right hand carry around a 3D cube, and turn your left hand into a flashlight.

This tutorial assumes you've finished our Getting Started guide. You can use either an Oculus Rift or HTC Vive. You will have to set up your headset's tracking base stations as, unlike the ZED Mini on your headset, the controllers have no means of tracking their position.

## Starting Your Project

* Start a new scene, [install the ZED Unity plugin](/docs/integrations/unity/#step-3-import-the-plugin), delete the Main Camera and drag **ZED\_Rig\_Stereo** (**Packages** -> **ZED SDK** -> **Prefabs**) into the Hierarchy.

  ![image](/_fern-img/33993440ae22d16336bc7188e140005e4a0d884fd4a965b8531baa4a5eea370f.webp)

## Tracking the Controllers

* Create two new empty GameObjects in the Hierarchy. Name one "Left Hand" and the other "Right Hand".

  ![image](/_fern-img/f32e6f4fb3189d74fbf41174f2db9ab99a5c9856c983daa442f95a1cde1d779f.webp)

* Add a **ZEDControllerTracker** component to each one.

  ![image](/_fern-img/6d888f02738001dd4e20234ffab1da2817f1a58094a4c9470bd3b0f034fb6c09.webp)

* Set the **Device to Track** field to "Left Controller" on the Left Hand object, and to "Right Controller" on the Right Hand object.

* Drag and drop the ZED\_Rig\_Stereo object into the **ZED Manager** field. This allows the script to compensate for drift when positioning the controllers.

The **ZEDControllerTracker** component will move these objects to match where your controller is, with a slight delay to compensate for the ZED image's latency.

## Augmenting Your Hands

Unlike VR, it's not recommended to put an object in your user's actual hand. Doing so makes any tracking errors extremely noticeable, since they have a near-perfect frame of reference right in front of their face.

Instead, we'll add an object floating in front of one hand, and make the other hand a flashlight without adding a visible model at all.

### Add a Floating Cube

* Right-click the Right Hand object and add a cube to it as a child by clicking **3D Object** -> **Cube**.

  ![image](/_fern-img/882b3c4a51eb3a48354a02339024e0a5323e082048f7f70d56521e0dcddf3189.webp)

* With the new cube selected, go to the Inspector and change its Z Position to **0.2** and its Scale to **X = 0.1, Y = 0.1, Z = 0.1**. This will make it hover 20 centimeters in front of the controller and shrink it down to a manageable size.

  ![image](/_fern-img/3d294916077fd456684a87185a3207d2b5c297770090d40f7a663ffbe7a57315.webp)

### Adding a Flashlight

Unlike the cube, we don't need to represent the light as a visible 3D object if we don't want to. Instead, we'll add the proper components directly to the left hand object.

* Select the Left Hand object
* Add the **ZEDLight** script. When you add it, it will automatically add Unity's **Light** component as well.
* Change the Light component's **Type** to **Spot**, the **Color** to a bright color of your choosing, and the **Intensity** to **10**. This'll make it a disco-style spotlight attached to your hand.

  ![image](/_fern-img/b29f9509a041ffb356667a5a0269bd68bc46e6512e87b3340c5375f4ca1b7438.webp)

### Run the Scene

You're ready to go! Run the scene, grab your controllers and play around. Move the cube around and behind real-world objects. Shine the light at surfaces near and far away, and with different angles. Change the color of the light to see how it looks. Congrats on becoming an augmented human being!