UxrManager.TeleportLocalAvatarRelativeAsync Method
Asynchronous version of TeleportLocalAvatar. Teleports the local UxrAvatar. The local avatar is the avatar controlled by the user using the headset and input controllers. Non-local avatars are other avatars instantiated in the scene but not controlled by the user, either other users through the network or other scenarios such as automated replays.
Namespace: UltimateXR.Core
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public Task TeleportLocalAvatarRelativeAsync(
Transform referenceTransform,
bool parentToReference,
Vector3 newFloorPosition,
Quaternion newRotation,
UxrTranslationType translationType = UxrTranslationType.Immediate,
float transitionSeconds = 0.2f,
Action teleportedCallback = null,
CancellationToken ct = default,
bool propagateEvents = true
)
Parameters
- referenceTransform
- Type: Transform
The object the avatar should keep relative position/orientation to. This should be the moving object the avatar has teleported on top of - parentToReference
- Type: System.Boolean
Whether to parent the avatar to referenceTransform. The avatar should be parented if it’s being teleported to a moving hierarchy it is not part of - newFloorPosition
- Type: Vector3
World-space floor-level position the avatar will be teleported over. The camera position will be on top of the floor position, keeping the original eye-level. - newRotation
- Type: Quaternion
World-space rotation the avatar will be teleported to. The camera will point in the rotation’s forward direction. - translationType (Optional)
- Type: UltimateXR.Locomotion.UxrTranslationType
The type of translation to use. By default it will teleport immediately - transitionSeconds (Optional)
- Type: System.Single
If translationType has a duration, it will specify how long the teleport transition will take in seconds. By default it is TeleportTranslationSeconds - teleportedCallback (Optional)
- Type: System.Action
Optional callback executed depending on the teleportation mode:- Immediate: Right after finishing the teleportation.
- Fade: When the screen is completely faded out and the avatar has been moved, before fading back in. This can be used to enable/disable/change GameObjects in the scene since the screen at this point is fully rendered using the fade color.
- Smooth: Right after finishing the teleportation.
- ct (Optional)
- Type: System.Threading.CancellationToken
Optional cancellation token that can be used to cancel the task - propagateEvents (Optional)
- Type: System.Boolean
Whether to propagate AvatarMoving/AvatarMoved events
Return Value
Type: Task
Awaitable Task that will finish after the avatar was teleported or if it was cancelled
Exceptions
Exception | Condition |
---|---|
TaskCanceledException | Task was canceled using ct |
Remarks
If Fade translation mode was specified, the default black fade color can be changed using TeleportFadeColor.