using System; using UnityEngine.SpatialTracking; namespace UnityEngine.Experimental.XR.Interaction { /// /// The BasePoseProvider type is used as the base interface for all "Pose Providers" /// Implementing this abstract class will allow the Pose Provider to be linked to a Tracked Pose Driver. /// [Serializable] public abstract class BasePoseProvider : MonoBehaviour { /// /// Gets the Pose value from the Pose Provider. /// Specializations will return the correct bitflags relating to the Pose data they are returning. /// /// When this method returns, contains the Pose data from the Pose Provider. /// Returns whether position and/or rotation was set on the Pose struct returned with . public virtual PoseDataFlags GetPoseFromProvider(out Pose output) { // Disabling the obsolete warning/error here so that no error is generated by the use of this function. #pragma warning disable 618,619 if (TryGetPoseFromProvider(out output)) { return PoseDataFlags.Position | PoseDataFlags.Rotation; } #pragma warning restore 618,619 return PoseDataFlags.NoData; } /// /// This function is provided for backwards compatibility with the BasePoseProvider found in com.unity.xr.legacyinputhelpers v1.3.X. /// Please do not implement this function, instead use the new API via . /// [Obsolete("This function is provided for backwards compatibility with the BasePoseProvider found in com.unity.xr.legacyinputhelpers v1.3.X. Please do not implement this function, instead use the new API via GetPoseFromProvider", false)] public virtual bool TryGetPoseFromProvider(out Pose output) { output = Pose.identity; return false; } } }