Skip to main content

Steam VR setup Tutorial #2 - Teleporting around your scene

Aims

The aim of thisThis tutorial isaims to show you how to enambleenable the teleporting feature included in the Steam VR 2.2 plugin.

Please notice that this is part of a series of tutorials progressing from basic concepts to more functional and complex proyects.projects. In previous pagespages, we already explored how to setupset up the scene you are expected to use for this tutorial.

Prerequisites

  1. Setting up the Steam VR plugin.
    Steam VR setup tutorial# 1

Getting started

In the Steam VR setup tutorial #1, we downloaded the Steam VR plugin and placed the "Player" prefab on our scene, in this tutorial we are going to setupset up the teleporting feature also included in the plugin, we are aloalso going to add a few teleporting spots to jump from one area to another. With our previous project open, please type "Teleporting" into the search box of the project panel.

Unity-SteamVR-Setup-17.PNG

Now just drag and drop the Teleport prefab into your "Hierarchy" panel, this will automatically enable the Teleport feature on both of your controllers, Before we test it, it is a good idea to change the defauldefault floor material in order to be able to clearly see the "Bézier curve". more clearly. Please select your Assets folder in the Project pannelpanel and right right-click to create a new material and name it "Blue".In order toTo keep things tidy, we recommend creating a "Materials" folder, then dragging your new material inside of it.

Unity-SteamVR-Setup-19.png

With your material selected, look at the inspector panel, you will see all the properties asociatedassociated to your material, please click on the colorcolour picker next to the Albedo slot.

Unity-SteamVR-Setup-20.PNG

You will see a colorcolour window, please drag both white circles in order to get the desired shade of blue, to finish just close the colorcolour window.

Unity-SteamVR-Setup-21.png

To apply your material, just drag it and drop it on top of the plane in the scene window.

Unity-SteamVR-Setup-22.png

Now we need to create a teleport area that will sit on top of our plane, the easiest way to achieve this is by duplicating our existing plane so right right-click over the plane gameObject in the "Hierarchy" and select duplicate.

Unity-SteamVR-Setup-23.png

In order to keep things tidy, let's rename our new gameObjetgame object and place it underneath the "Teleport" prefab.

Unity-SteamVR-Setup-24.png

Now let's add the "Teleport Area" script to our new gameObject, please notice that if you are importing a custom mesh to use it as a Teleporting Area you have to make sure that it has a "Mesh collider"Collider" component attached, in this case, as we duplicated a 3D object created directly in Unity, the Mesh collider is attached by default. With the "Teleporting Area" gameObject selected, click the "Add component" button in the "Inspector" panel and type "Teleport Area" and click over the "Teleport Area" script.

Unity-SteamVR-Setup-25.png

Finally, we need to move the "Teleporting Area" slightly up to place on top of the first plane, this is to avoid conflict between the colliders on both of the planes, With the "Teleport Area" gameObject selected, type "0.1" in the "Y" position slot of the transform component.

Unity-SteamVR-Setup-26.PNG

Now we are ready to test the Teleporting feature, Just hit the "Play" button. Once inside of your scene, please press the "Trackpad" button, you will see a "Bézier curve" projecting from the front of your controller to the ground. Try changing the angle of your controller in order to move the landing point, then, just let go the button and you will be teletransported to that location.

Unity-SteamVR-Setup-27.png

Unity-SteamVR-Setup-28.png