using UnityEngine.XR.ARSubsystems;
namespace UnityEngine.XR.ARFoundation
{
///
/// Represents the tracking mode for the session.
///
public enum TrackingMode
{
///
/// The tracking mode is not specified and will be chosen automatically.
///
DontCare = 0,
///
/// 3 degrees of freedom for orientation only.
///
RotationOnly = 1,
///
/// 6 degrees of freedom including both orientation and position.
///
PositionAndRotation = 2,
}
///
/// Extensions for the and Feature enums,
/// allowing conversion between the two.
///
public static class TrackingModeExtensions
{
///
/// Converts a to a UnityEngine.XR.ARSubsystems.Feature.
///
/// The being extended.
/// A Feature with the appropriate tracking mode bits set.
public static Feature ToFeature(this TrackingMode self)
{
switch (self)
{
case TrackingMode.RotationOnly: return Feature.RotationOnly;
case TrackingMode.PositionAndRotation: return Feature.PositionAndRotation;
default: return Feature.None;
}
}
///
/// Converts a UnityEngine.XR.ARSubsystems.Feature to a .
///
/// The Feature being extended.
/// The representation of .
public static TrackingMode ToTrackingMode(this Feature self)
{
switch(self.TrackingModes())
{
case Feature.RotationOnly: return TrackingMode.RotationOnly;
case Feature.PositionAndRotation: return TrackingMode.PositionAndRotation;
default: return TrackingMode.DontCare;
}
}
}
}