SteamVR: Mapping Objects to Vive Controllers in Unity

Rushil Reddy

Following from our previous tutorial on how to set up your Vive for Unity development we are now going to learn how to map objects onto your hands. If you want to follow along make sure the SteamVR plug in has been imported and that you’ve dragged in a CameraRig prefab.

Go to the asset store and search for sci-fi gun.

Download and import it and then drag a copy of the specular weapon prefab into the scene.

Open up the CameraRig dropdown in the hierarchy tab and drag the weapon as a child onto Controller(Right). Do the same for Controller(Left). The weapon should now be on the same level as another object called model.

Now, click on the weapon model and then in the inspector panel(on the right) set the transform y rotation to 90 and the z rotation to 45.

Change the scale from 1 to 2 on the x,y,and z axis as well. Now hit apply beneath the transform and it will change the values for both guns we have imported.

In the hierarchy tab click on each of the objects named models. Next look to your right on the inspector tab and unclick the first checkbox to disable them.

That’s it! Hit the play button and put on your headset.