UxrManager.TeleportLocalAvatarAsync 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 TeleportLocalAvatarAsync(
	Vector3 newFloorPosition,
	Quaternion newRotation,
	UxrTranslationType translationType = UxrTranslationType.Immediate,
	float transitionSeconds = 0.2f,
	Action teleportedCallback = null,
	CancellationToken ct = default,
	bool propagateEvents = true
)


Parameters

 

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

ExceptionCondition
TaskCanceledExceptionTask was canceled using ct

Remarks

If Fade translation mode was specified, the default black fade color can be changed using TeleportFadeColor.

See Also

Reference

UxrManager Class
UltimateXR.Core Namespace