#if UNITY_INPUT_SYSTEM || PACKAGE_DOCS_GENERATION
using UnityEngine.Scripting;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
using UnityEngine.InputSystem.XR;
#endif
namespace Unity.XR.Oculus.Input
{
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
///
/// An Oculus VR headset (such as the Oculus Rift series of devices).
///
[Preserve]
[InputControlLayout(displayName = "Oculus Headset")]
public class OculusHMD : XRHMD
{
[Preserve]
[InputControl]
public ButtonControl userPresence { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "devicetrackingstate" })]
public new IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "deviceistracked" })]
public new ButtonControl isTracked { get; private set; }
[Preserve]
[InputControl]
public new Vector3Control devicePosition { get; private set; }
[Preserve]
[InputControl]
public new QuaternionControl deviceRotation { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAngularAcceleration { get; private set; }
[Preserve]
[InputControl]
public new Vector3Control leftEyePosition { get; private set; }
[Preserve]
[InputControl]
public new QuaternionControl leftEyeRotation { get; private set; }
[Preserve]
[InputControl]
public Vector3Control leftEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl]
public Vector3Control leftEyeAcceleration { get; private set; }
[Preserve]
[InputControl]
public Vector3Control leftEyeAngularAcceleration { get; private set; }
[Preserve]
[InputControl]
public new Vector3Control rightEyePosition { get; private set; }
[Preserve]
[InputControl]
public new QuaternionControl rightEyeRotation { get; private set; }
[Preserve]
[InputControl]
public Vector3Control rightEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl]
public Vector3Control rightEyeAcceleration { get; private set; }
[Preserve]
[InputControl]
public Vector3Control rightEyeAngularAcceleration { get; private set; }
[Preserve]
[InputControl]
public new Vector3Control centerEyePosition { get; private set; }
[Preserve]
[InputControl]
public new QuaternionControl centerEyeRotation { get; private set; }
[Preserve]
[InputControl]
public Vector3Control centerEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl]
public Vector3Control centerEyeAcceleration { get; private set; }
[Preserve]
[InputControl]
public Vector3Control centerEyeAngularAcceleration { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
userPresence = GetChildControl("userPresence");
trackingState = GetChildControl("trackingState");
isTracked = GetChildControl("isTracked");
devicePosition = GetChildControl("devicePosition");
deviceRotation = GetChildControl("deviceRotation");
deviceAngularVelocity = GetChildControl("deviceAngularVelocity");
deviceAcceleration = GetChildControl("deviceAcceleration");
deviceAngularAcceleration = GetChildControl("deviceAngularAcceleration");
leftEyePosition = GetChildControl("leftEyePosition");
leftEyeRotation = GetChildControl("leftEyeRotation");
leftEyeAngularVelocity = GetChildControl("leftEyeAngularVelocity");
leftEyeAcceleration = GetChildControl("leftEyeAcceleration");
leftEyeAngularAcceleration = GetChildControl("leftEyeAngularAcceleration");
rightEyePosition = GetChildControl("rightEyePosition");
rightEyeRotation = GetChildControl("rightEyeRotation");
rightEyeAngularVelocity = GetChildControl("rightEyeAngularVelocity");
rightEyeAcceleration = GetChildControl("rightEyeAcceleration");
rightEyeAngularAcceleration = GetChildControl("rightEyeAngularAcceleration");
centerEyePosition = GetChildControl("centerEyePosition");
centerEyeRotation = GetChildControl("centerEyeRotation");
centerEyeAngularVelocity = GetChildControl("centerEyeAngularVelocity");
centerEyeAcceleration = GetChildControl("centerEyeAcceleration");
centerEyeAngularAcceleration = GetChildControl("centerEyeAngularAcceleration");
}
}
///
/// An Oculus Touch controller.
///
[Preserve]
[InputControlLayout(displayName = "Oculus Touch Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class OculusTouchController : XRControllerWithRumble
{
[Preserve]
[InputControl(aliases = new[] { "Primary2DAxis", "Joystick" })]
public Vector2Control thumbstick { get; private set; }
[Preserve]
[InputControl]
public AxisControl trigger { get; private set; }
[Preserve]
[InputControl]
public AxisControl grip { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "A", "X", "Alternate" })]
public ButtonControl primaryButton { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "B", "Y", "Primary" })]
public ButtonControl secondaryButton { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "GripButton" })]
public ButtonControl gripPressed { get; private set; }
[Preserve]
[InputControl]
public ButtonControl start { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "JoystickOrPadPressed", "thumbstickClick" })]
public ButtonControl thumbstickClicked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "ATouched", "XTouched", "ATouch", "XTouch" })]
public ButtonControl primaryTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "BTouched", "YTouched", "BTouch", "YTouch" })]
public ButtonControl secondaryTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "indexTouch", "indexNearTouched" })]
public AxisControl triggerTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "indexButton", "indexTouched" })]
public ButtonControl triggerPressed { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "JoystickOrPadTouched", "thumbstickTouch" })]
public ButtonControl thumbstickTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerTrackingState" })]
public new IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "ControllerIsTracked" })]
public new ButtonControl isTracked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerPosition" })]
public new Vector3Control devicePosition { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerRotation" })]
public new QuaternionControl deviceRotation { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerVelocity" })]
public Vector3Control deviceVelocity { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerAngularVelocity" })]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerAcceleration" })]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "controllerAngularAcceleration" })]
public Vector3Control deviceAngularAcceleration { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
thumbstick = GetChildControl("thumbstick");
trigger = GetChildControl("trigger");
triggerTouched = GetChildControl("triggerTouched");
grip = GetChildControl("grip");
primaryButton = GetChildControl("primaryButton");
secondaryButton = GetChildControl("secondaryButton");
gripPressed = GetChildControl("gripPressed");
start = GetChildControl("start");
thumbstickClicked = GetChildControl("thumbstickClicked");
primaryTouched = GetChildControl("primaryTouched");
secondaryTouched = GetChildControl("secondaryTouched");
thumbstickTouched = GetChildControl("thumbstickTouched");
triggerPressed = GetChildControl("triggerPressed");
trackingState = GetChildControl("trackingState");
isTracked = GetChildControl("isTracked");
devicePosition = GetChildControl("devicePosition");
deviceRotation = GetChildControl("deviceRotation");
deviceVelocity = GetChildControl("deviceVelocity");
deviceAngularVelocity = GetChildControl("deviceAngularVelocity");
deviceAcceleration = GetChildControl("deviceAcceleration");
deviceAngularAcceleration = GetChildControl("deviceAngularAcceleration");
}
}
#endif
[Preserve]
[InputControlLayout(displayName = "Oculus Tracking Reference")]
public class OculusTrackingReference : InputDevice
{
[Preserve]
[InputControl(aliases = new[] { "trackingReferenceTrackingState" })]
public IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "trackingReferenceIsTracked" })]
public ButtonControl isTracked { get; private set; }
[Preserve]
[InputControl]
public Vector3Control devicePosition { get; private set; }
[Preserve]
[InputControl]
public QuaternionControl deviceRotation { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
trackingState = GetChildControl("trackingState");
isTracked = GetChildControl("isTracked");
devicePosition = GetChildControl("devicePosition");
deviceRotation = GetChildControl("deviceRotation");
}
}
///
/// An Oculus Remote controller.
///
[Preserve]
[InputControlLayout(displayName = "Oculus Remote")]
public class OculusRemote : InputDevice
{
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public ButtonControl start { get; private set; }
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
back = GetChildControl("back");
start = GetChildControl("start");
touchpad = GetChildControl("touchpad");
}
}
#if ENABLE_VR || PACKAGE_DOCS_GENERATION
///
/// An Oculus Go controller.
///
///
/// Go is no longer supported in 2020.1+ and this will be removed in a future Oculus XR Plugin.
///
[Preserve]
[InputControlLayout(hideInUI = true, displayName = "Oculus Go Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class OculusGoController : GearVRTrackedController
{
}
///
/// A Standalone VR headset that includes on-headset controls.
///
///
/// This device was never supported by the Oculus XR Plugin and will be removed in a future Oculus XR Plugin.
///
[Preserve]
[InputControlLayout(hideInUI = true, displayName = "Oculus Headset (w/ on-headset controls)")]
public class OculusHMDExtended : OculusHMD
{
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
back = GetChildControl("back");
touchpad = GetChildControl("touchpad");
}
}
///
/// A Gear VR controller.
///
///
/// This device was never supported by the Oculus XR Plugin and will be removed in a future Oculus XR Plugin.
/// Use OculusGoController instead if targeting the Oculus Go.
///
[Preserve]
[InputControlLayout(hideInUI = true, displayName = "GearVR Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class GearVRTrackedController : XRController
{
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
[Preserve]
[InputControl]
public AxisControl trigger { get; private set; }
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public ButtonControl triggerPressed { get; private set; }
[Preserve]
[InputControl]
public ButtonControl touchpadClicked { get; private set; }
[Preserve]
[InputControl]
public ButtonControl touchpadTouched { get; private set; }
[Preserve]
[InputControl]
public new IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl]
public new ButtonControl isTracked { get; private set; }
[Preserve]
[InputControl]
public new Vector3Control devicePosition { get; private set; }
[Preserve]
[InputControl]
public new QuaternionControl deviceRotation { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl]
public Vector3Control deviceAngularAcceleration { get; private set; }
protected override void FinishSetup()
{
base.FinishSetup();
touchpad = GetChildControl("touchpad");
trigger = GetChildControl("trigger");
back = GetChildControl("back");
triggerPressed = GetChildControl("triggerPressed");
touchpadClicked = GetChildControl("touchpadClicked");
touchpadTouched = GetChildControl("touchpadTouched");
trackingState = GetChildControl("trackingState");
isTracked = GetChildControl("isTracked");
devicePosition = GetChildControl("devicePosition");
deviceRotation = GetChildControl("deviceRotation");
deviceAngularVelocity = GetChildControl("deviceAngularVelocity");
deviceAcceleration = GetChildControl("deviceAcceleration");
deviceAngularAcceleration = GetChildControl("deviceAngularAcceleration");
}
}
#endif
}
#endif