#if ENABLE_VR || UNITY_GAMECORE || PACKAGE_DOCS_GENERATION using System.Runtime.InteropServices; using UnityEngine.InputSystem.Layouts; using UnityEngine.InputSystem.LowLevel; using UnityEngine.InputSystem.Utilities; namespace UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation { /// /// State for input device representing a simulated XR HMD. /// [StructLayout(LayoutKind.Explicit, Size = 117)] public struct XRSimulatedHMDState : IInputStateTypeInfo { /// /// Memory format identifier for . /// /// public static FourCC formatId => new FourCC('X', 'R', 'S', 'H'); /// /// The data format identifier of the state. /// public FourCC format => formatId; /// /// The position of the left eye on this device. /// [InputControl(usage = "LeftEyePosition", offset = 0)] [FieldOffset(0)] public Vector3 leftEyePosition; /// /// The rotation of the left eye on this device. /// [InputControl(usage = "LeftEyeRotation", offset = 12)] [FieldOffset(12)] public Quaternion leftEyeRotation; /// /// The position of the right eye on this device. /// [InputControl(usage = "RightEyePosition", offset = 28)] [FieldOffset(28)] public Vector3 rightEyePosition; /// /// The rotation of the right eye on this device. /// [InputControl(usage = "RightEyeRotation", offset = 40)] [FieldOffset(40)] public Quaternion rightEyeRotation; /// /// The position of the center eye on this device. /// [InputControl(usage = "CenterEyePosition", offset = 56)] [FieldOffset(56)] public Vector3 centerEyePosition; /// /// The rotation of the center eye on this device. /// [InputControl(usage = "CenterEyeRotation", offset = 68)] [FieldOffset(68)] public Quaternion centerEyeRotation; /// /// Represents the values being tracked for this device. /// [InputControl(usage = "TrackingState", layout = "Integer", offset = 84)] [FieldOffset(84)] public int trackingState; /// /// Informs to the developer whether the device is currently being tracked. /// [InputControl(usage = "IsTracked", layout = "Button", offset = 88)] [FieldOffset(88)] public bool isTracked; /// /// The position of the device. /// [InputControl(usage = "DevicePosition", offset = 89)] [FieldOffset(89)] public Vector3 devicePosition; /// /// The rotation of this device. /// [InputControl(usage = "DeviceRotation", offset = 101)] [FieldOffset(101)] public Quaternion deviceRotation; /// /// Resets the value of all fields to default or the identity rotation. /// public void Reset() { leftEyePosition = default; leftEyeRotation = Quaternion.identity; rightEyePosition = default; rightEyeRotation = Quaternion.identity; centerEyePosition = default; centerEyeRotation = Quaternion.identity; trackingState = default; isTracked = default; devicePosition = default; deviceRotation = Quaternion.identity; } } } #endif