Class TeleportationAnchor
An anchor is a teleportation destination which teleports the user to a pre-determined specific position and/or rotation.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Teleportation Anchor", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation.TeleportationAnchor.html")]
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
public class TeleportationAnchor : BaseTeleportationInteractable, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect, IXRReticleDirectionProvider
Properties
teleportAnchorTransform
The Transform that represents the teleportation destination.
Declaration
public Transform teleportAnchorTransform { get; set; }
Property Value
Type | Description |
---|---|
Transform |
See Also
Methods
GenerateTeleportRequest(IXRInteractor, RaycastHit, ref TeleportRequest)
Automatically called upon the teleport trigger event occurring to generate the teleport request. The teleportation destination pose should be filled out.
Declaration
protected override bool GenerateTeleportRequest(IXRInteractor interactor, RaycastHit raycastHit, ref TeleportRequest teleportRequest)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The interactor that initiated the teleport trigger. |
RaycastHit | raycastHit | The ray cast hit information from the interactor. |
TeleportRequest | teleportRequest | The teleport request that should be filled out during this method call. |
Returns
Type | Description |
---|---|
bool | Returns true if the teleport request was successfully updated and should be queued. Otherwise, returns false. |
Overrides
See Also
GetAttachTransform(IXRInteractor)
Gets the Transform that serves as the attachment point for a given Interactor.
Declaration
public override Transform GetAttachTransform(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The specific Interactor as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Transform | Returns the attachment point Transform. |
Overrides
Remarks
This should typically return the Transform of a child GameObject or the transform itself.
See Also
OnDrawGizmos()
Unity calls this when drawing gizmos.
Declaration
protected void OnDrawGizmos()
See Also
OnValidate()
See MonoBehaviour.
Declaration
protected void OnValidate()
See Also
RequestTeleport()
Attempts to queue a request to teleport to this anchor. This method can be called from script to initiate teleportation manually rather than relying on the interaction system to initiate teleportation. May not succeed in teleporting if the anchor Transform is destroyed or there is no TeleportationProvider.
Declaration
public void RequestTeleport()
Remarks
Due to script execution order of the TeleportationProvider, depending on when this method is called, teleportation of the XR Origin may not occur until the next frame.
See Also
Reset()
See MonoBehaviour.
Declaration
protected override void Reset()