SteamVR ships with an easy to use teleport system that requires very little setup. If you’ve played the lab, you’ve seen the system in action. It allows for quick teleportation to specified areas.
To setup the SteamVR teleportation system, there are a couple requirements.
If you want to work along with the steps below, you’ll need the SteamVR plugin installed. If you just want to read though, skip ahead to “Hands”
Next, you’ll want to create an empty cube and scale it to (20, 1, 20).
Add some material to the floor, in my example below, you’ll see I went with a wood plank material I found somewhere..
Finally, add a [CameraRig] prefab from the SteamVR plugin prefabs folder.
The SteamVR teleport system is coupled with the lab’s interaction system. As such, it requires the use of the Hand and player objects.
The way it’s done in the samples, and the way I prefer to do it is create two new empty children under the [CameraRig].
Re-name them “Left Hand” & “Right Hand”
Add the “Hand” component to each of them.
Set the “Other Hand” field on both of them by dragging the other ‘hand’ into the field for each of them.
For the Right hand, make sure to set the “Starting Hand Type” to right (the default value is left).
For teleport interactions to work, you’ll need to add the “Player” component to the [CameraRig].
Drag & add the Camera(eye) to the “Hmd Transforms” array.
Add the Left & Right hands to the “Hands” array.
Next, you’ll need to add the “Teleporting” prefab to the scene.
You can find the “Teleporting” prefab in SteamVR/InteractionSystem/Teleport/Prefabs
Drag & Add the Teleporting prefab to the scene.
Before we can teleport, we’ll need to tell the system where a valid teleport point is. Again, the SteamVR system comes with a great prefab to get started.
Take the TeleportPoint prefab and place a couple instances in the scene above the ground.
Teleport Points – Testing
Now use the trackpad to teleport to the different teleport points.
Teleport Points – Scene Loading
Though we won’t use it here, I also wanted to point out that the Teleport Point has a “Teleport Type” option on it.
This allows you to make the point load a different scene when the player moves there. If you want to use this functionality, just switch the type and enter the scene name.
The final step before we can teleport is to add a “Teleport Area”.
A teleport area works a lot like the teleport point, but allows you to specify a bigger ‘area’ where you can land.
One way to set this up would be to just add the “Teleport Area” component to the floor. If you try this though, the ground material will change, and when you’re not teleporting, the ground will be disabled completely.
Instead, what we’ll do is clone the ground object, move it a bit, and make that our teleport area.
Duplicate the floor.
Make the duplicate a child of the floor
Re-name it to “Floor – Teleport Area”
Set the Y position to 0.01
Add the “Teleport Area” component to it
As I mentioned above, you’ll notice that the material has automatically changed to “TeleportAreaVisible”. Again, this is controlled by the “Teleporting” prefab in the scene and one of the reasons we can’t just add the component to the ground.
Teleport Area – Testing
With this in place, you should be able to hit play and teleport all around the area. Also notice that the teleport points will work fine alongside the area.
The SteamVR interaction system used in the lab is a great starting point for many projects. If you’re looking to get the basics down, definitely check this system out. It doesn’t cover every form of movement though and is only a small sampling of the possible locomotion types you can add. But if you just need good teleport movement, it’s easy to setup and works well. If you’re interested in other locomotion systems, drop a comment below and let me know what you’d like to learn more about.