All the Controls, Only Two Hands!

addam davis
5 min readJan 25, 2024

Objective: Create Action Based Controller Manager.

If you have followed along with me and read my previous tutorials in VR, then you will remember we did not use the XR origin that was provided by Unity. We created our own. In doing that we need to make some changes to our hands to have them working properly.

Looking in the action map you will see the hands have three different action maps each. Currently we have no way navigate to different action maps. This tutorial we will set up this functionality.

If you downloaded the starter assets, inside is a flushed out XR Origin. We are not going to use this other than to look at how this is set up and see the changes we need to make to our own.

There are some differences. Don’t feel overwhelmed, we are going to work through this together.

Selecting the right hand that we created and then select the prefab right hand to see what all is different.

They both have the XR Controller, and that seems to be all they have in common. The prefab contains the Action based controller manager and none of the ray interactor scripts. If we look at the prefab again, we will notice that they have broken all the interactors into child objects to the controller.

We are going to follow this blue print and create the same for our hand controllers as well. First, we need to get rid of what we no longer need on the right hand. We don’t need the Ray Interactor, the Line Renderer, or the Line Visual.

We can now rebuild this as a child to the right hand controller. Right-click the controller, scroll to XR, and select Ray Interactor.

Now we have a second game object that only handles the Ray Interactor. Comparing this to the prefab version and you will notice that ours has an XR controller. We don’t need it so delete it.

Continuing from here we can now create a Direct Interactor the same way we did the Ray Interactor.

Again, remove the XR Controller.

From here we are ready to make the Teleport Interactor. The way we make this is by creating a Ray Interactor and modifying it.

Rename it for clarity later.

This look pretty identical to the prefab version, however, if you notice there is a big difference. The prefab version has its tracking disabled as well as changed its select action to the teleport select action.

Doing this changes the grip button that we had before for teleporting to using the joystick up, which is the more traditional way of teleporting in VR.

Let’s do this with our controller. we can start with the preset which will set up most of what we are after.

Now we can modify it by removing the position actions and disabling input tracking.

Now we want to change the inputs for Select Action and Select Action Value to the Teleport Select Action.

Now it’s time to set up the right hand controller. To match our controller to the prefab we need to add the Action Based Controller manager and the XR Interaction Group.

Now we need to hook it up.

First things it asks for is an XR Interaction Group so lets add that component right away.

All the Interaction group does is limit our interactors. This means only one can be used at a time. We need to attach the XR Interaction Manager to the Interaction Group.

Now we can attach the XR Interaction Group to the Actions Based Controller manager.

Then we need to attach the Direct, Ray, and Teleport Interactors.

Next is the Controller Action references. Unfortunately, there is no preset for this one so we will have to set this up manually. Luckly it’s simple, only tedious.

Repeat for every Action.

Finally, we need to populate the starting group members in the XR Interaction Group. In our case, we are going to have two members, the Ray and Teleport Interactors.

Now we can disable the prefab and test out our controlls.

Success! We can now teleport using our joystick. We also now know how to properlly set up the controllers in VR! I’ll see you in the next tutorial!