Skip to main content

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

  1. Download and install Unity 2018.2.21f1.
    More resent versions might also work, this tutorial was made using Unity 2018.2.21f1

  2. 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.

  3. 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.

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 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.

Unity-SteamVR-Setup-19.png

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.

Unity-SteamVR-Setup-20.PNG

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.

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 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 gameObjet 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" 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

InFinally, orderwe 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 this,the youTeleporting justfeature, need toJust hit the "Play". button. Once inside of your scene, you just need toplease 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.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