{"_id":"5b1f8576c2505d00031254ae","category":{"_id":"5b1f8576c2505d0003125428","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:41:26.797Z","from_sync":false,"order":4,"slug":"locomotion","title":"Locomotion"},"parentDoc":null,"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","version":{"_id":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":4,"forked_from":"594949e52be16d0026ec04cd","createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["5b1f8576c2505d0003125424","5b1f8576c2505d0003125425","5b1f8576c2505d0003125426","5b1f8576c2505d0003125427","5b1f8576c2505d0003125428","5b1f8576c2505d0003125429","5b1f8576c2505d000312542a","5b1f8576c2505d000312542b","5b1f8576c2505d000312542c","5b1f8576c2505d000312542d","5b1f8576c2505d000312542e","5b1f8576c2505d000312542f","5b1f8576c2505d0003125430","5b1f8576c2505d0003125431","5b1f8576c2505d0003125432","5b1f8576c2505d0003125433","5b1f8576c2505d0003125434","5b1f8576c2505d0003125435","5b1f8576c2505d0003125436","5b1f8576c2505d0003125437","5b1f8576c2505d0003125438","5b1f8aab9c683000032979e7","5b1f8b2f3073470003ffa5da","5b1f8bd9fd653400031d94f4","5b1f900bd4c5f000036b57bd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mangalica","version_clean":"3.3.0","version":"3.3.0"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T16:42:19.304Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"## Overview\n\nUpdates the `x/z` position of the SDK Camera Rig with an optional screen fade.\n\n  > The `y` position is not altered by the Basic Teleport so it only allows for movement across a 2D plane.\n\n**Script Usage:**\n * Place the `VRTK_BasicTeleport` script on any active scene GameObject.\n\n**Script Dependencies:**\n * An optional Destination Marker (such as a Pointer) to set the destination of the teleport location.\n\n## Inspector Parameters\n\n * **Blink To Color:** The colour to fade to when fading on teleport.\n * **Blink Transition Speed:** The time taken to fade to the `Blink To Color`. Setting the speed to `0` will mean no fade effect is present.\n * **Distance Blink Delay:** Determines how long the fade will stay present out depending on the distance being teleported. A value of `0` will not delay the teleport fade effect over any distance, a max value will delay the teleport fade in even when the distance teleported is very close to the original position.\n * **Headset Position Compensation:** If this is checked then the teleported location will be the position of the headset within the play area. If it is unchecked then the teleported location will always be the centre of the play area even if the headset position is not in the centre of the play area.\n * **Target List Policy:** A specified VRTK_PolicyList to use to determine whether destination targets will be acted upon by the teleporter.\n * **Nav Mesh Data:** An optional NavMeshData object that will be utilised for limiting the teleport to within any scene NavMesh.\n\n## Class Events\n\n * `Teleporting` - Emitted when the teleport process has begun.\n * `Teleported` - Emitted when the teleport process has successfully completed.\n\n## Unity Events\n\nAdding the `VRTK_BasicTeleport_UnityEvents` component to `VRTK_BasicTeleport` object allows access to `UnityEvents` that will react identically to the Class Events.\n\n * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`.\n\n## Event Payload\n\n * `float distance` - The distance between the origin and the collided destination.\n * `Transform target` - The Transform of the collided destination object.\n * `RaycastHit raycastHit` - The optional RaycastHit generated from when the ray collided.\n * `Vector3 destinationPosition` - The world position of the destination marker.\n * `Quaternion? destinationRotation` - The world rotation of the destination marker.\n * `bool forceDestinationPosition` - If true then the given destination position should not be altered by anything consuming the payload.\n * `bool enableTeleport` - Whether the destination set event should trigger teleport.\n * `VRTK_ControllerReference controllerReference` - The optional reference to the controller controlling the destination marker.\n\n## Class Methods\n\n### InitDestinationSetListener/2\n\n  > `public virtual void InitDestinationSetListener(GameObject markerMaker, bool register)`\n\n * Parameters\n   * `GameObject markerMaker` - The game object that is used to generate destination marker events, such as a controller.\n   * `bool register` - Determines whether to register or unregister the listeners.\n * Returns\n   * _none_\n\nThe InitDestinationSetListener method is used to register the teleport script to listen to events from the given game object that is used to generate destination markers. Any destination set event emitted by a registered game object will initiate the teleport to the given destination location.\n\n### ToggleTeleportEnabled/1\n\n  > `public virtual void ToggleTeleportEnabled(bool state)`\n\n * Parameters\n   * `bool state` - Toggles whether the teleporter is enabled or disabled.\n * Returns\n   * _none_\n\nThe ToggleTeleportEnabled method is used to determine whether the teleporter will initiate a teleport on a destination set event, if the state is true then the teleporter will work as normal, if the state is false then the teleporter will not be operational.\n\n### ValidLocation/2\n\n  > `public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)`\n\n * Parameters\n   * `Transform target` - The Transform that the destination marker is touching.\n   * `Vector3 destinationPosition` - The position in world space that is the destination.\n * Returns\n   * `bool` - Returns `true` if the target is a valid location.\n\nThe ValidLocation method determines if the given target is a location that can be teleported to\n\n### Teleport/1\n\n  > `public virtual void Teleport(DestinationMarkerEventArgs teleportArgs)`\n\n * Parameters\n   * `DestinationMarkerEventArgs teleportArgs` - The pseudo Destination Marker event for the teleport action.\n * Returns\n   * _none_\n\nThe Teleport/1 method calls the teleport to update position without needing to listen for a Destination Marker event.\n\n### Teleport/4\n\n  > `public virtual void Teleport(Transform target, Vector3 destinationPosition, Quaternion? destinationRotation = null, bool forceDestinationPosition = false)`\n\n * Parameters\n   * `Transform target` - The Transform of the destination object.\n   * `Vector3 destinationPosition` - The world position to teleport to.\n   * `Quaternion? destinationRotation` - The world rotation to teleport to.\n   * `bool forceDestinationPosition` - If `true` then the given destination position should not be altered by anything consuming the payload.\n * Returns\n   * _none_\n\nThe Teleport/4 method calls the teleport to update position without needing to listen for a Destination Marker event. It will build a destination marker out of the provided parameters.\n\n### ForceTeleport/2\n\n  > `public virtual void ForceTeleport(Vector3 destinationPosition, Quaternion? destinationRotation = null)`\n\n * Parameters\n   * `Vector3 destinationPosition` - The world position to teleport to.\n   * `Quaternion? destinationRotation` - The world rotation to teleport to.\n * Returns\n   * _none_\n\nThe ForceTeleport method forces the position to update to a given destination and ignores any target checking or floor adjustment.\n\n### SetActualTeleportDestination/2\n\n  > `public virtual void SetActualTeleportDestination(Vector3 actualPosition, Quaternion? actualRotation)`\n\n * Parameters\n   * `Vector3 actualPosition` - The actual position that the teleport event should use as the final location.\n   * `Quaternion? actualRotation` - The actual rotation that the teleport event should use as the final location.\n * Returns\n   * _none_\n\nThe SetActualTeleportDestination method forces the destination of a teleport event to the given Vector3.\n\n### ResetActualTeleportDestination/0\n\n  > `public virtual void ResetActualTeleportDestination()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ResetActualTeleportDestination method removes any previous forced destination position that was set by the SetActualTeleportDestination method.\n\n## Example\n\n`VRTK/Examples/004_CameraRig_BasicTeleport` uses the `VRTK_Pointer` script on the Controllers to initiate a laser pointer by pressing the `Touchpad` on the controller and when the laser pointer is deactivated (release the `Touchpad`) then the user is teleported to the location of the laser pointer tip as this is where the pointer destination marker position is set to.","excerpt":"","slug":"vrtk_basicteleport","type":"basic","title":"VRTK_BasicTeleport"}

VRTK_BasicTeleport


## Overview Updates the `x/z` position of the SDK Camera Rig with an optional screen fade. > The `y` position is not altered by the Basic Teleport so it only allows for movement across a 2D plane. **Script Usage:** * Place the `VRTK_BasicTeleport` script on any active scene GameObject. **Script Dependencies:** * An optional Destination Marker (such as a Pointer) to set the destination of the teleport location. ## Inspector Parameters * **Blink To Color:** The colour to fade to when fading on teleport. * **Blink Transition Speed:** The time taken to fade to the `Blink To Color`. Setting the speed to `0` will mean no fade effect is present. * **Distance Blink Delay:** Determines how long the fade will stay present out depending on the distance being teleported. A value of `0` will not delay the teleport fade effect over any distance, a max value will delay the teleport fade in even when the distance teleported is very close to the original position. * **Headset Position Compensation:** If this is checked then the teleported location will be the position of the headset within the play area. If it is unchecked then the teleported location will always be the centre of the play area even if the headset position is not in the centre of the play area. * **Target List Policy:** A specified VRTK_PolicyList to use to determine whether destination targets will be acted upon by the teleporter. * **Nav Mesh Data:** An optional NavMeshData object that will be utilised for limiting the teleport to within any scene NavMesh. ## Class Events * `Teleporting` - Emitted when the teleport process has begun. * `Teleported` - Emitted when the teleport process has successfully completed. ## Unity Events Adding the `VRTK_BasicTeleport_UnityEvents` component to `VRTK_BasicTeleport` object allows access to `UnityEvents` that will react identically to the Class Events. * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`. ## Event Payload * `float distance` - The distance between the origin and the collided destination. * `Transform target` - The Transform of the collided destination object. * `RaycastHit raycastHit` - The optional RaycastHit generated from when the ray collided. * `Vector3 destinationPosition` - The world position of the destination marker. * `Quaternion? destinationRotation` - The world rotation of the destination marker. * `bool forceDestinationPosition` - If true then the given destination position should not be altered by anything consuming the payload. * `bool enableTeleport` - Whether the destination set event should trigger teleport. * `VRTK_ControllerReference controllerReference` - The optional reference to the controller controlling the destination marker. ## Class Methods ### InitDestinationSetListener/2 > `public virtual void InitDestinationSetListener(GameObject markerMaker, bool register)` * Parameters * `GameObject markerMaker` - The game object that is used to generate destination marker events, such as a controller. * `bool register` - Determines whether to register or unregister the listeners. * Returns * _none_ The InitDestinationSetListener method is used to register the teleport script to listen to events from the given game object that is used to generate destination markers. Any destination set event emitted by a registered game object will initiate the teleport to the given destination location. ### ToggleTeleportEnabled/1 > `public virtual void ToggleTeleportEnabled(bool state)` * Parameters * `bool state` - Toggles whether the teleporter is enabled or disabled. * Returns * _none_ The ToggleTeleportEnabled method is used to determine whether the teleporter will initiate a teleport on a destination set event, if the state is true then the teleporter will work as normal, if the state is false then the teleporter will not be operational. ### ValidLocation/2 > `public virtual bool ValidLocation(Transform target, Vector3 destinationPosition)` * Parameters * `Transform target` - The Transform that the destination marker is touching. * `Vector3 destinationPosition` - The position in world space that is the destination. * Returns * `bool` - Returns `true` if the target is a valid location. The ValidLocation method determines if the given target is a location that can be teleported to ### Teleport/1 > `public virtual void Teleport(DestinationMarkerEventArgs teleportArgs)` * Parameters * `DestinationMarkerEventArgs teleportArgs` - The pseudo Destination Marker event for the teleport action. * Returns * _none_ The Teleport/1 method calls the teleport to update position without needing to listen for a Destination Marker event. ### Teleport/4 > `public virtual void Teleport(Transform target, Vector3 destinationPosition, Quaternion? destinationRotation = null, bool forceDestinationPosition = false)` * Parameters * `Transform target` - The Transform of the destination object. * `Vector3 destinationPosition` - The world position to teleport to. * `Quaternion? destinationRotation` - The world rotation to teleport to. * `bool forceDestinationPosition` - If `true` then the given destination position should not be altered by anything consuming the payload. * Returns * _none_ The Teleport/4 method calls the teleport to update position without needing to listen for a Destination Marker event. It will build a destination marker out of the provided parameters. ### ForceTeleport/2 > `public virtual void ForceTeleport(Vector3 destinationPosition, Quaternion? destinationRotation = null)` * Parameters * `Vector3 destinationPosition` - The world position to teleport to. * `Quaternion? destinationRotation` - The world rotation to teleport to. * Returns * _none_ The ForceTeleport method forces the position to update to a given destination and ignores any target checking or floor adjustment. ### SetActualTeleportDestination/2 > `public virtual void SetActualTeleportDestination(Vector3 actualPosition, Quaternion? actualRotation)` * Parameters * `Vector3 actualPosition` - The actual position that the teleport event should use as the final location. * `Quaternion? actualRotation` - The actual rotation that the teleport event should use as the final location. * Returns * _none_ The SetActualTeleportDestination method forces the destination of a teleport event to the given Vector3. ### ResetActualTeleportDestination/0 > `public virtual void ResetActualTeleportDestination()` * Parameters * _none_ * Returns * _none_ The ResetActualTeleportDestination method removes any previous forced destination position that was set by the SetActualTeleportDestination method. ## Example `VRTK/Examples/004_CameraRig_BasicTeleport` uses the `VRTK_Pointer` script on the Controllers to initiate a laser pointer by pressing the `Touchpad` on the controller and when the laser pointer is deactivated (release the `Touchpad`) then the user is teleported to the location of the laser pointer tip as this is where the pointer destination marker position is set to.