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 uses the MaskHolder component to manage teleportation behavior. This component must be present in the world and provides two key masks:

  • ray_intersection_mask - determines which surfaces the teleport ray can detect. Surfaces matching this mask will be considered as potential landing points.
  • teleport_allowed_mask - determines which of the detected surfaces actually allow teleportation. If a surface is detected by the ray but doesn't match this mask, teleportation will be forbidden (indicated by a red marker).

MaskHolder Component (C++)

To restrict teleportation to a certain area, do the following:

  1. Create a plane primitive: go to Create → Primitive → Plane in the Menu Bar. This will be the area where teleportation is forbidden.

    Create Primitive Plane

  2. Scale and position the plane in the scene just above the floor, covering the area you want to restrict.

  3. In the Parameters window, set the Intersection mask on the mesh surface so that it matches the ray_intersection_mask but does NOT match the teleport_allowed_mask in the MaskHolder component. This way, the teleport ray will detect this surface but display a forbidden marker.

    Setting Intersection Masks (C++)

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

  5. To hide the Static Mesh, disable all bits of its Viewport and Shadow masks.

  6. Save changes and run the application: the rectangular plane is invisible now.

The information on this page is valid for UNIGINE 2.22 SDK.

Last update: 2026-09-11 03:51:51