Restricting Teleportations
In VR projects, sometimes we use teleporting to move around, especially in large scenes.
By default, you can teleport to any point of the scene. But sometimes, it might be necessary to restrict teleportation to certain areas (for example, to the roof). The VR Template provides the TeleportationMovement component (assigned to the vr_layer -> vr_movement_manager -> teleportation_movement node) that implements teleportation logic and allows specifying the maximum teleportation distance, the appearance of the ray and target point, and so on.
You can teleport to an object if its Physics Intersection mask matches the Teleportation mask in the component settings. By default, the second bit of the Teleportation mask is used. So, you can teleport to objects for which the Physics Intersection option is enabled, and the second bit of the Physics Intersection mask is set.
To restrict teleportation to a certain area, do the following:
- Create a new Static Mesh object by using the default plane (core/meshes/plane.mesh) or an arbitrary mesh that will define the restricted area.
- Place the Static Mesh in the scene just above the floor.
-
In the Parameters window, enable the Physics Intersection option for the object and check that the second bit of the Physics Intersection mask is disabled.
-
Save and run the application. Now, you cannot teleport to the area defined by the rectangular plane (the ray and the target point are red).
-
To hide the Static Mesh, disable all bits of its Viewport and Shadow masks.
-
Save changes and run the application: the rectangular plane is invisible now.