using System; using System.Runtime.InteropServices; namespace UnityEngine.XR.ARSubsystems { /// /// Container for the data that represents a trackable human body. /// [StructLayout (LayoutKind.Sequential)] public struct XRHumanBody : IEquatable, ITrackable { /// /// The trackable identifier for the human body. /// /// /// The trackable identifier for the human body. /// public TrackableId trackableId { get => m_TrackableId; private set => m_TrackableId = value; } TrackableId m_TrackableId; /// /// The pose for the human body origin. /// /// /// The pose for the human body origin. /// public Pose pose { get => m_Pose; private set => m_Pose = value; } Pose m_Pose; /// /// The scale factor that relates the implementation's default body height to the estimated height. /// /// /// The scale factor that relates the implementation's default body height to the estimated height. /// public float estimatedHeightScaleFactor { get => m_EstimatedHeightScaleFactor; private set => m_EstimatedHeightScaleFactor = value; } float m_EstimatedHeightScaleFactor; /// /// The tracking state for the human body. /// /// /// The tracking state for the human body. /// public TrackingState trackingState { get => m_TrackingState; private set => m_TrackingState = value; } TrackingState m_TrackingState; /// /// The native pointer to the implementation-specific human body. /// /// /// The native pointer to the implementation-specific human body. /// public IntPtr nativePtr { get => m_NativePtr; private set => m_NativePtr = value; } IntPtr m_NativePtr; /// /// Get the default human body data. /// /// /// The default human body data. /// public static XRHumanBody defaultValue => s_Default; static readonly XRHumanBody s_Default = new XRHumanBody { trackableId = TrackableId.invalidId, pose = Pose.identity, estimatedHeightScaleFactor = 1.0f, }; /// /// Tests for equality. /// /// The other to compare against. /// `True` if every field in is equal to this , otherwise false. public bool Equals(XRHumanBody other) => m_TrackableId.Equals(other.m_TrackableId); /// /// Tests for equality. /// /// The `object` to compare against. /// `True` if is of type and /// also returns `true`; otherwise `false`. public override bool Equals(System.Object obj) => ((obj is XRHumanBody) && Equals((XRHumanBody)obj)); /// /// Tests for equality. Same as . /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// `True` if is equal to , otherwise `false`. public static bool operator ==(XRHumanBody lhs, XRHumanBody rhs) => lhs.Equals(rhs); /// /// Tests for inequality. Same as `!`. /// /// The left-hand side of the comparison. /// The right-hand side of the comparison. /// `True` if is not equal to , otherwise `false`. public static bool operator !=(XRHumanBody lhs, XRHumanBody rhs) => !lhs.Equals(rhs); /// /// Generates a hash suitable for use with containers like `HashSet` and `Dictionary`. /// /// A hash code generated from this object's fields. public override int GetHashCode() => m_TrackableId.GetHashCode(); } }