Maze / Library /PackageCache /com.unity.inputsystem@1.6.1 /InputSystem /Plugins /XR /Devices /Oculus.cs
| // ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled. | |
| // Docs generation is skipped because these are intended to be replaced with the com.unity.xr.oculus package. | |
| using UnityEngine.InputSystem; | |
| using UnityEngine.InputSystem.Controls; | |
| using UnityEngine.InputSystem.Layouts; | |
| using UnityEngine.InputSystem.XR; | |
| namespace Unity.XR.Oculus.Input | |
| { | |
| /// <summary> | |
| /// An Oculus VR headset (such as the Oculus Rift series of devices). | |
| /// </summary> | |
| [] | |
| public class OculusHMD : XRHMD | |
| { | |
| [] | |
| [] { "devicetrackingstate" })] | |
| [] { "deviceistracked" })] | |
| public ButtonControl userPresence { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAcceleration { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularAcceleration { get; private set; } | |
| [] | |
| public Vector3Control leftEyeAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control leftEyeAcceleration { get; private set; } | |
| [] | |
| public Vector3Control leftEyeAngularAcceleration { get; private set; } | |
| [] | |
| public Vector3Control rightEyeAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control rightEyeAcceleration { get; private set; } | |
| [] | |
| public Vector3Control rightEyeAngularAcceleration { get; private set; } | |
| [] | |
| public Vector3Control centerEyeAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control centerEyeAcceleration { get; private set; } | |
| [] | |
| public Vector3Control centerEyeAngularAcceleration { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| userPresence = GetChildControl<ButtonControl>("userPresence"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration"); | |
| deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration"); | |
| leftEyeAngularVelocity = GetChildControl<Vector3Control>("leftEyeAngularVelocity"); | |
| leftEyeAcceleration = GetChildControl<Vector3Control>("leftEyeAcceleration"); | |
| leftEyeAngularAcceleration = GetChildControl<Vector3Control>("leftEyeAngularAcceleration"); | |
| rightEyeAngularVelocity = GetChildControl<Vector3Control>("rightEyeAngularVelocity"); | |
| rightEyeAcceleration = GetChildControl<Vector3Control>("rightEyeAcceleration"); | |
| rightEyeAngularAcceleration = GetChildControl<Vector3Control>("rightEyeAngularAcceleration"); | |
| centerEyeAngularVelocity = GetChildControl<Vector3Control>("centerEyeAngularVelocity"); | |
| centerEyeAcceleration = GetChildControl<Vector3Control>("centerEyeAcceleration"); | |
| centerEyeAngularAcceleration = GetChildControl<Vector3Control>("centerEyeAngularAcceleration"); | |
| } | |
| } | |
| /// <summary> | |
| /// An Oculus Touch controller. | |
| /// </summary> | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class OculusTouchController : XRControllerWithRumble | |
| { | |
| [] { "Primary2DAxis", "Joystick" })] | |
| public Vector2Control thumbstick { get; private set; } | |
| [] | |
| public AxisControl trigger { get; private set; } | |
| [] | |
| public AxisControl grip { get; private set; } | |
| [] { "A", "X", "Alternate" })] | |
| public ButtonControl primaryButton { get; private set; } | |
| [] { "B", "Y", "Primary" })] | |
| public ButtonControl secondaryButton { get; private set; } | |
| [] { "GripButton" })] | |
| public ButtonControl gripPressed { get; private set; } | |
| [] | |
| public ButtonControl start { get; private set; } | |
| [] { "JoystickOrPadPressed", "thumbstickClick" })] | |
| public ButtonControl thumbstickClicked { get; private set; } | |
| [] { "ATouched", "XTouched", "ATouch", "XTouch" })] | |
| public ButtonControl primaryTouched { get; private set; } | |
| [] { "BTouched", "YTouched", "BTouch", "YTouch" })] | |
| public ButtonControl secondaryTouched { get; private set; } | |
| [] { "indexTouch", "indexNearTouched" })] | |
| public AxisControl triggerTouched { get; private set; } | |
| [] { "indexButton", "indexTouched" })] | |
| public ButtonControl triggerPressed { get; private set; } | |
| [] { "JoystickOrPadTouched", "thumbstickTouch" })] | |
| [] { "controllerTrackingState" })] | |
| [] { "ControllerIsTracked" })] | |
| [] { "controllerPosition" })] | |
| [] { "controllerRotation" })] | |
| public ButtonControl thumbstickTouched { get; private set; } | |
| [] { "controllerVelocity" })] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] { "controllerAngularVelocity" })] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| [] { "controllerAcceleration" })] | |
| public Vector3Control deviceAcceleration { get; private set; } | |
| [] { "controllerAngularAcceleration" })] | |
| public Vector3Control deviceAngularAcceleration { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| thumbstick = GetChildControl<Vector2Control>("thumbstick"); | |
| trigger = GetChildControl<AxisControl>("trigger"); | |
| triggerTouched = GetChildControl<AxisControl>("triggerTouched"); | |
| grip = GetChildControl<AxisControl>("grip"); | |
| primaryButton = GetChildControl<ButtonControl>("primaryButton"); | |
| secondaryButton = GetChildControl<ButtonControl>("secondaryButton"); | |
| gripPressed = GetChildControl<ButtonControl>("gripPressed"); | |
| start = GetChildControl<ButtonControl>("start"); | |
| thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked"); | |
| primaryTouched = GetChildControl<ButtonControl>("primaryTouched"); | |
| secondaryTouched = GetChildControl<ButtonControl>("secondaryTouched"); | |
| thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration"); | |
| deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration"); | |
| } | |
| } | |
| public class OculusTrackingReference : TrackedDevice | |
| { | |
| [] { "trackingReferenceTrackingState" })] | |
| public new IntegerControl trackingState { get; private set; } | |
| [] { "trackingReferenceIsTracked" })] | |
| public new ButtonControl isTracked { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| trackingState = GetChildControl<IntegerControl>("trackingState"); | |
| isTracked = GetChildControl<ButtonControl>("isTracked"); | |
| } | |
| } | |
| /// <summary> | |
| /// An Oculus Remote controller. | |
| /// </summary> | |
| [] | |
| public class OculusRemote : InputDevice | |
| { | |
| [] | |
| public ButtonControl back { get; private set; } | |
| [] | |
| public ButtonControl start { get; private set; } | |
| [] | |
| public Vector2Control touchpad { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| back = GetChildControl<ButtonControl>("back"); | |
| start = GetChildControl<ButtonControl>("start"); | |
| touchpad = GetChildControl<Vector2Control>("touchpad"); | |
| } | |
| } | |
| /// <summary> | |
| /// A Standalone VR headset that includes on-headset controls. | |
| /// </summary> | |
| [] | |
| public class OculusHMDExtended : OculusHMD | |
| { | |
| [] | |
| public ButtonControl back { get; private set; } | |
| [] | |
| public Vector2Control touchpad { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| back = GetChildControl<ButtonControl>("back"); | |
| touchpad = GetChildControl<Vector2Control>("touchpad"); | |
| } | |
| } | |
| /// <summary> | |
| /// A Gear VR controller. | |
| /// </summary> | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class GearVRTrackedController : XRController | |
| { | |
| [] | |
| public Vector2Control touchpad { get; private set; } | |
| [] | |
| public AxisControl trigger { get; private set; } | |
| [] | |
| public ButtonControl back { get; private set; } | |
| [] | |
| public ButtonControl triggerPressed { get; private set; } | |
| [] | |
| public ButtonControl touchpadClicked { get; private set; } | |
| [] | |
| public ButtonControl touchpadTouched { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAcceleration { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularAcceleration { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| touchpad = GetChildControl<Vector2Control>("touchpad"); | |
| trigger = GetChildControl<AxisControl>("trigger"); | |
| back = GetChildControl<ButtonControl>("back"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked"); | |
| touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration"); | |
| deviceAngularAcceleration = GetChildControl<Vector3Control>("deviceAngularAcceleration"); | |
| } | |
| } | |
| } | |