UxrManager.TeleportLocalAvatarRelativeCoroutine Method

Public teleporting coroutine that can be yielded from an external coroutine. 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 IEnumerator TeleportLocalAvatarRelativeCoroutine(
	Transform referenceTransform,
	bool parentToReference,
	Vector3 newRelativeFloorPosition,
	Quaternion newRelativeRotation,
	UxrTranslationType translationType = UxrTranslationType.Immediate,
	float transitionSeconds = 0.2f,
	Action teleportedCallback = null,
	Action 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. If null, newRelativeFloorPosition and newRelativeRotation will be interpreted as world coordinates.
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
newRelativeFloorPosition
Type: Vector3
New floor-level position the avatar will be teleported over in referenceTransform local coordinates. If referenceTransform is null, coordinates will be interpreted as being in world-space. The camera position will be on top of the floor position, keeping the original eye-level.
newRelativeRotation
Type: Quaternion
Local rotation the avatar will be teleported to with respect to [!:referenceTransform]. If referenceTransform is null, rotation will be in world-space. 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
Optional callback executed right after the teleportation finished. 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: IEnumerator
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