All the Controls, Only Two Hands! (Layer Mask Update)

addam davis
2 min readJan 25, 2024

--

Objective: Use Layer Masks to control our Ray Interactors and Teleport Interactors.

If you followed along with the previous tutorial, you may notice that not only, can you teleport using the right joystick up, but you also still teleport when you use the right grip button.

We can implement the use of Layer masks to fix this. We want our teleport Interactors to interact with teleport areas, or anchors. You also want the Ray Interactors to interact with everything else.

Select the Teleport Interactor and in the XR Ray Interactor at the top you will find the Interaction Layer Masks.

Again, we only want the Teleport Interactor to interact with all things related to teleporting. So, open the layer masks and select nothing to unselect everything, then select Teleport.

Depending on the version of Unity you are using you may need to add your own layers. If you do then don’t fear. Simply add the name of the layer you want to use. We are going to be setting the teleport area and anchors to that layer next anyways.

Next, it’s time to limit the Layer Mask for the Ray Interactors. Simply unselect the Teleport layer.

Now when you are playing in your editor the ray no longer lights up when facing the ground meaning you cannot teleport using the grip button, only when you press up with the joystick!

I’ll see you in the next tutorial!

--

--