Steam VR setup Tutorial #2 - Teleporting around your scene
Aims
The aim of this tutorial is to show you how to enamble the teleporting feature included in the Steam VR plugin.
Prerequisites
-
Download and install Unity 2018.2.21f1.
More resent versions might also work, this tutorial was made using Unity 2018.2.21f1
-
Create a Unity personal account.
In order to use Unity you will have to create our own personal account as it will ask you to login when you start running the software.
- Download and install Steam. Steam platform will install aditional components needed to run the HTC VIVE on your computer. Click here to go to the Steam download page.
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 setup the teleporting feature also included in the plugin, we are alo 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.
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 defaul floor material in order to be able to clearly see the "Bézier curve". Please select your Assets folder in the Project pannel and right click to create a new material and name it "Blue".In order to keep things tidy, we recommend creating a "Materials" folder, then dragging your new material inside of it.
With your material selected, look at the inspector panel, you will see all the properties asociated to your material, please click on the color picker next to the Albedo slot.
You will see a color window, please drag both white circles in order to get the desired shade of blue, to finish just close the color window.
To apply your material, just drag it and drop it on top of the plane in the scene window.
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 click over the plane gameObject in the "Hierarchy" and select duplicate.
In order to keep things tidy, let's rename our new gameObjet and place it underneath the "Teleport" prefab.
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" 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.
In order to test this, you just need to hit "Play". Once inside of your scene, you just need to 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.