Teleportation System
The HoloMIT SDK’s teleportation module enables users to move instantly within the environment using a raycast-driven pointer and a configurable arc. It works with Unity’s New Input System and the XR Interaction Toolkit to provide a smooth, VR-friendly teleport experience.
Overview
- Draws an arc or straight ray from the controller to preview teleport destinations.
- Supports selection and confirmation via configurable Input Actions.
- Automatically disables the pointer visualization when the activation button is released.
- Teleports the player’s transform to the detected ground point, applying a small offset along the surface normal to avoid clipping.
Requirements
- Unity 2022.3 LTS or later
- New Input System package enabled
- XR Interaction Toolkit (for VR detection and controller tracking)
- CharacterController or similar on the player’s body for collision handling (optional but recommended)
Setup
- Add the TeleporterController component to your player rig:
- Assign the right-hand transform (
rightHand
). - Assign the player body transform (
bodyTransform
) that will teleport. - Provide materials for teleportable (
lineTeleportableMat
) and non-teleportable (lineNotTeleportableMat
) surfaces.
- Assign the right-hand transform (
- Configure the InputActionReferences:
- teleportAction: button to activate the pointer (hold).
- touchAction: (optional) for pointer feedback.
- interactAction: button to confirm teleport destination.
- Set raycastLayers to include the valid teleport surface layers.
- (Optional) Enable canRotate and adjust
rotationSpeed
to allow snap or smooth rotation while aiming. - Add the VRTeleporter component under your controller to enable arc-based teleportation:
- Assign the
positionMarker
prefab to indicate landing points. - Configure
angle
,strength
, andmaxVertexcount
to tune arc shape and performance.
- Assign the
Exposed Parameters
Property | Type | Description |
---|---|---|
teleportAction | InputActionReference | Input action to toggle the teleport pointer. |
touchAction | InputActionReference | Secondary input for pointer feedback (optional). |
interactAction | InputActionReference | Input action to confirm the teleport destination. |
raycastLayers | LayerMask | Layers considered valid for teleportation. |
canRotate | bool | Enables rotation while aiming. |
rotationSpeed | float | Rotation speed when canRotate is enabled. |
angle | float | Launch angle for the arc in VRTeleporter (default: 45°). |
strength | float | Initial velocity multiplier for the arc (default: 10). |
maxVertexcount | int | Maximum vertices for the arc to optimize performance. |
Usage
- Activate Pointer: Hold the
teleportAction
to show the pointer or arc. - Aim: Point at a valid surface; the material and marker update to indicate validity.
- Confirm: Press the
interactAction
to teleport. - Automatic Cleanup: The pointer and marker hide automatically after teleporting.
Known Limitations
- No built-in fade or blink transition; consider adding a screen fade for comfort.
- Arc updates are frame-rate dependent; smoothing may be needed for consistent feedback.
- Ground detection uses Unity physics; ensure valid colliders on teleport surfaces.
- Teleport ignores obstacles between the marker and player; verify that landing areas are safe.