Class BaseTeleportationInteractable
This is intended to be the base class for all Teleportation Interactables. This abstracts the teleport request process for specializations of this class.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
public abstract class BaseTeleportationInteractable : XRBaseInteractable, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect, IXRReticleDirectionProvider
Properties
filterSelectionByHitNormal
When set to true, this teleportation interactable will only be selectable by a ray interactor if its current hit normal is aligned with this object's up vector.
Declaration
public bool filterSelectionByHitNormal { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
matchDirectionalInput
Whether or not to rotate the rig to match the forward direction of the attach transform of the selecting interactor. This only applies when matchOrientation is set to WorldSpaceUp or TargetUp.
Declaration
public bool matchDirectionalInput { get; set; }
Property Value
Type | Description |
---|---|
bool |
matchOrientation
How to orient the rig after teleportation.
Declaration
public MatchOrientation matchOrientation { get; set; }
Property Value
Type | Description |
---|---|
MatchOrientation |
Remarks
Set to:
- WorldSpaceUp to stay oriented according to the world space up vector.
- TargetUp to orient according to the target BaseTeleportationInteractable Transform's up vector.
- TargetUpAndForward to orient according to the target BaseTeleportationInteractable Transform's rotation.
- None to maintain the same orientation before and after teleporting.
teleportTrigger
Specifies when the teleportation triggers.
Declaration
public BaseTeleportationInteractable.TeleportTrigger teleportTrigger { get; set; }
Property Value
Type | Description |
---|---|
BaseTeleportationInteractable.TeleportTrigger |
teleportationProvider
The teleportation provider that this teleportation interactable communicates teleport requests to. If no teleportation provider is configured, will attempt to find a teleportation provider.
Declaration
public TeleportationProvider teleportationProvider { get; set; }
Property Value
Type | Description |
---|---|
TeleportationProvider |
teleporting
Gets or sets the event that Unity calls when queuing to teleport via the TeleportationProvider.
Declaration
public TeleportingEvent teleporting { get; set; }
Property Value
Type | Description |
---|---|
TeleportingEvent |
Remarks
The TeleportingEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
upNormalToleranceDegrees
The tolerance in degrees from this object's up vector for a hit normal to be considered aligned with the up vector.
Declaration
public float upNormalToleranceDegrees { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
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 virtual 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. |
See Also
GetReticleDirection(IXRInteractor, Vector3, out Vector3, out Vector3?)
Get the reticle direction based on the given interactor's attach transform.
Declaration
public void GetReticleDirection(IXRInteractor interactor, Vector3 hitNormal, out Vector3 reticleUp, out Vector3? optionalReticleForward)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The interactor whose attach transform determines the reticle direction. |
Vector3 | hitNormal | The normal of the surface the reticle is placed on. This is the default value for |
Vector3 | reticleUp | The returned up direction of the reticle. |
Vector3? | optionalReticleForward | The returned forward direction which will be projected onto the plane
defined by |
IsSelectableBy(IXRSelectInteractor)
Determines if a given Interactor can select this Interactable.
Declaration
public override bool IsSelectableBy(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | Interactor to check for a valid selection with. |
Returns
Type | Description |
---|---|
bool | Returns true if selection is valid this frame. Returns false if not. |
Overrides
See Also
OnActivated(ActivateEventArgs)
XRBaseInputInteractor calls this method when the Interactor begins an activation event on this Interactable.
Declaration
protected override void OnActivated(ActivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ActivateEventArgs | args | Event data containing the Interactor that is sending the activate event. |
Overrides
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnDeactivated(DeactivateEventArgs)
XRBaseInputInteractor calls this method when the Interactor ends an activation event on this Interactable.
Declaration
protected override void OnDeactivated(DeactivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
DeactivateEventArgs | args | Event data containing the Interactor that is sending the deactivate event. |
Overrides
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
protected override void OnSelectEntered(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactor that is initiating the selection. |
Overrides
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
protected override void OnSelectExited(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactor that is ending the selection. |
Overrides
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
ProcessInteractable(UpdatePhase)
The XRInteractionManager calls this method to update the Interactable.
Declaration
public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Overrides
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
Reset()
See MonoBehaviour.
Declaration
protected override void Reset()
Overrides
SendTeleportRequest(IXRInteractor)
Queues a request to teleport. This method can be called from script to initiate teleportation manually rather than relying on the interaction system to initiate teleportation.
Declaration
protected bool SendTeleportRequest(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The interactor, if any, that initiated the teleport trigger. If null, the teleport request will be generated without a raycast hit. |
Returns
Type | Description |
---|---|
bool | Returns true if successfully queued. Otherwise, returns false. |
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.