// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) VRMADA, All rights reserved. // // -------------------------------------------------------------------------------------------------------------------- using UnityEngine; namespace UltimateXR.Locomotion { /// /// Describes a teleportation destination. /// public class UxrTeleportDestination { #region Public Types & Data /// /// Gets the where the avatar will be positioned on. /// public Transform Destination { get; } /// /// Gets the raycast hit information that was used to select the destination. /// public RaycastHit HitInfo { get; } /// /// Gets the new avatar world position. /// public Vector3 Position { get; } /// /// Gets the new avatar world rotation. /// public Quaternion Rotation { get; } /// /// Gets the new avatar position in local space. /// public Vector3 LocalDestinationPosition { get; } /// /// Gets the new avatar rotation in local space. /// public Quaternion LocalDestinationRotation { get; } #endregion #region Constructors & Finalizer /// /// Constructor. /// /// The raycast hit information that was used to select the destination /// New avatar world position /// New avatar world rotation public UxrTeleportDestination(RaycastHit hitInfo, Vector3 position, Quaternion rotation) { Destination = hitInfo.collider != null ? hitInfo.collider.transform : null; HitInfo = hitInfo; Position = position; Rotation = rotation; LocalDestinationPosition = Destination != null ? Destination.InverseTransformPoint(position) : Vector3.zero; LocalDestinationRotation = Destination != null ? Quaternion.Inverse(Destination.rotation) * rotation : Quaternion.identity; } #endregion } }