UxrManager.TeleportLocalAvatarRelative Method

Teleports the local UxrAvatar while making sure to keep relative position/orientation on moving objects. Some translationType values have a transition before the teleport to avoid motion sickness. On worlds with moving platforms it is important to specify the destination transform so that:  

  • Relative position/orientation to the destination is preserved.
  • Optionally the local avatar can be parented to the new destination.
  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 void TeleportLocalAvatarRelative(
	Transform referenceTransform,
	bool parentToReference,
	Vector3 newFloorPosition,
	Quaternion newRotation,
	UxrTranslationType translationType = UxrTranslationType.Immediate,
	float transitionSeconds = 0.2f,
	Action teleportedCallback = null,
	Action<bool> finishedCallback = null,
	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.
finishedCallback (Optional)
Type: System.Action(Boolean)
Optional callback executed right after the teleportation finished. It will receive a boolean parameter telling whether the teleport finished completely (true) or was cancelled (false). If a fade effect has been requested, the callback is executed right after the screen has faded back in.
propagateEvents (Optional)
Type: System.Boolean
Whether to propagate AvatarMoving/AvatarMoved events

Return Value

Type:
Coroutine enumerator

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