minesweeper_game/Library/PackageCache/com.unity.xr.legacyinputhelpers@b7579e86f3b4/Runtime/TrackedPoseDriver/BasePoseProvider.cs
2025-03-15 14:30:26 -04:00

45 lines
2.2 KiB
C#

using System;
using UnityEngine.SpatialTracking;
namespace UnityEngine.Experimental.XR.Interaction
{
/// <summary>
/// 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.
/// </summary>
[Serializable]
public abstract class BasePoseProvider : MonoBehaviour
{
/// <summary>
/// Gets the Pose value from the Pose Provider.
/// Specializations will return the correct bitflags relating to the Pose data they are returning.
/// </summary>
/// <param name="output">When this method returns, contains the Pose data from the Pose Provider.</param>
/// <returns>Returns whether position and/or rotation was set on the Pose struct returned with <paramref name="output"/>.</returns>
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;
}
/// <summary>
/// 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 <see cref="GetPoseFromProvider"/>.
/// </summary>
/// <param name="output">This function is deprecated and sets the output parameter to Pose.identity.</param>
/// <returns>This function is deprecated and returns false.</returns>
[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;
}
}
}