Sometimes you need to prevent the viewer from teleporting into certain areas of the scene, like backstage or onto tech risers. This tutorial will outline how to use VRTK’s Policy List component to tag objects in the scene for teleport exclusion.
Add Mesh Colliders
Determine which objects in your scene you do not want the viewer to be able to teleport onto, such as the stage, chairs, people, etc. Select these objects all at the same time and add a Mesh Collider component in the Inspector window.
Perhaps you want to prevent them from walking backstage but there is no object blocking their path. In this case you could create an invisible object for the pointer to collide with in order to trigger an invalid teleport location.
Create a 3D cube object in the project panel and scale it up to take up all the 3D Space where you don’t want teleport enabled. Add a mesh or a box collider component. Then apply an albedo material with a transparent or zero value alpha channel, see screenshot below.
Set tags to ExcludeTeleport
Select all the objects in your scene that you do not want the viewer to be able to teleport through. Then, in the top of the inspector window change the tag from Untagged to ExcludeTeleport. Notice the spelling of this tag: uppercase E and T, no spacing between the words. If prompted, say yes to apply tag to all children.
Select the object in your scene that has the Basic Teleport script on it. In my tutorials, I typically put this script onto an empty game object named “Play Area”. In the inspector, add the VRTK_PolicyList component onto the object.
Write “ExcludeTeleport” (Notice the caps and spacing is the same as the Tag) into the Element 0 field.
Specify Policy List Object
Drag the game object with the VRTK_PolicyList component onto the ‘Target List Policy’ field in the VRKT_Basic Teleport (Script) component.
Pointer Display on Invalid Location
Lastly, go into your tracked remote and confirm that your pointer renderer is showing an obvious color for invalid locations, like bright red for example. Then confirm that your VRTK_PlayAreaCursor has ‘Display on Invalid Location’ enabled.
I hope this information will make learning VR easier and more enjoyable. One of the goals of ScenicMentor.com is to help designers work faster, giving them more time to create and more easily share their ideas with the world!
I’d love to hear comments or suggestions. Contact me here.