Maze / Library /PackageCache /com.unity.inputsystem@1.6.1 /InputSystem /Plugins /XR /Devices /OpenVR.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.openvr package. | |
| using UnityEngine.InputSystem; | |
| using UnityEngine.InputSystem.Controls; | |
| using UnityEngine.InputSystem.Layouts; | |
| using UnityEngine.InputSystem.XR; | |
| namespace Unity.XR.OpenVR | |
| { | |
| [] | |
| public class OpenVRHMD : XRHMD | |
| { | |
| [] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control leftEyeVelocity { get; private set; } | |
| [] | |
| public Vector3Control leftEyeAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control rightEyeVelocity { get; private set; } | |
| [] | |
| public Vector3Control rightEyeAngularVelocity { get; private set; } | |
| [] | |
| public Vector3Control centerEyeVelocity { get; private set; } | |
| [] | |
| public Vector3Control centerEyeAngularVelocity { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| leftEyeVelocity = GetChildControl<Vector3Control>("leftEyeVelocity"); | |
| leftEyeAngularVelocity = GetChildControl<Vector3Control>("leftEyeAngularVelocity"); | |
| rightEyeVelocity = GetChildControl<Vector3Control>("rightEyeVelocity"); | |
| rightEyeAngularVelocity = GetChildControl<Vector3Control>("rightEyeAngularVelocity"); | |
| centerEyeVelocity = GetChildControl<Vector3Control>("centerEyeVelocity"); | |
| centerEyeAngularVelocity = GetChildControl<Vector3Control>("centerEyeAngularVelocity"); | |
| } | |
| } | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class OpenVRControllerWMR : XRController | |
| { | |
| [] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| [] { "primary2DAxisClick", "joystickOrPadPressed" })] | |
| public ButtonControl touchpadClick { get; private set; } | |
| [] { "primary2DAxisTouch", "joystickOrPadTouched" })] | |
| public ButtonControl touchpadTouch { get; private set; } | |
| [] | |
| public ButtonControl gripPressed { get; private set; } | |
| [] | |
| public ButtonControl triggerPressed { get; private set; } | |
| [] { "primary" })] | |
| public ButtonControl menu { get; private set; } | |
| [] | |
| public AxisControl trigger { get; private set; } | |
| [] | |
| public AxisControl grip { get; private set; } | |
| [] { "secondary2DAxis" })] | |
| public Vector2Control touchpad { get; private set; } | |
| [] { "primary2DAxis" })] | |
| public Vector2Control joystick { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| touchpadClick = GetChildControl<ButtonControl>("touchpadClick"); | |
| touchpadTouch = GetChildControl<ButtonControl>("touchpadTouch"); | |
| gripPressed = GetChildControl<ButtonControl>("gripPressed"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| menu = GetChildControl<ButtonControl>("menu"); | |
| trigger = GetChildControl<AxisControl>("trigger"); | |
| grip = GetChildControl<AxisControl>("grip"); | |
| touchpad = GetChildControl<Vector2Control>("touchpad"); | |
| joystick = GetChildControl<Vector2Control>("joystick"); | |
| } | |
| } | |
| /// <summary> | |
| /// An HTC Vive Wand controller. | |
| /// </summary> | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class ViveWand : XRControllerWithRumble | |
| { | |
| [] | |
| public AxisControl grip { get; private set; } | |
| [] | |
| public ButtonControl gripPressed { get; private set; } | |
| [] | |
| public ButtonControl primary { get; private set; } | |
| [] { "primary2DAxisClick", "joystickOrPadPressed" })] | |
| public ButtonControl trackpadPressed { get; private set; } | |
| [] { "primary2DAxisTouch", "joystickOrPadTouched" })] | |
| public ButtonControl trackpadTouched { get; private set; } | |
| [] { "Primary2DAxis" })] | |
| public Vector2Control trackpad { get; private set; } | |
| [] | |
| public AxisControl trigger { get; private set; } | |
| [] | |
| public ButtonControl triggerPressed { get; private set; } | |
| [] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| grip = GetChildControl<AxisControl>("grip"); | |
| primary = GetChildControl<ButtonControl>("primary"); | |
| gripPressed = GetChildControl<ButtonControl>("gripPressed"); | |
| trackpadPressed = GetChildControl<ButtonControl>("trackpadPressed"); | |
| trackpadTouched = GetChildControl<ButtonControl>("trackpadTouched"); | |
| trackpad = GetChildControl<Vector2Control>("trackpad"); | |
| trigger = GetChildControl<AxisControl>("trigger"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| } | |
| } | |
| /// <summary> | |
| /// An HTC Vive lighthouse. | |
| /// </summary> | |
| [] | |
| public class ViveLighthouse : TrackedDevice | |
| { | |
| } | |
| /// <summary> | |
| /// An HTC Vive tracker. | |
| /// </summary> | |
| [] | |
| public class ViveTracker : TrackedDevice | |
| { | |
| [] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| } | |
| } | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class HandedViveTracker : ViveTracker | |
| { | |
| [] | |
| public AxisControl grip { get; private set; } | |
| [] | |
| public ButtonControl gripPressed { get; private set; } | |
| [] | |
| public ButtonControl primary { get; private set; } | |
| [] { "JoystickOrPadPressed" })] | |
| public ButtonControl trackpadPressed { get; private set; } | |
| [] | |
| public ButtonControl triggerPressed { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| grip = GetChildControl<AxisControl>("grip"); | |
| primary = GetChildControl<ButtonControl>("primary"); | |
| gripPressed = GetChildControl<ButtonControl>("gripPressed"); | |
| trackpadPressed = GetChildControl<ButtonControl>("trackpadPressed"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| base.FinishSetup(); | |
| } | |
| } | |
| /// <summary> | |
| /// An Oculus Touch controller. | |
| /// </summary> | |
| [] { "LeftHand", "RightHand" }, hideInUI = true)] | |
| public class OpenVROculusTouchController : XRControllerWithRumble | |
| { | |
| [] | |
| public Vector2Control thumbstick { get; private set; } | |
| [] | |
| public AxisControl trigger { get; private set; } | |
| [] | |
| public AxisControl grip { get; private set; } | |
| // Primary & Secondary are switched in order to retain consistency with the Oculus SDK | |
| [] { "Alternate" })] | |
| public ButtonControl primaryButton { get; private set; } | |
| [] { "Primary" })] | |
| public ButtonControl secondaryButton { get; private set; } | |
| [] | |
| public ButtonControl gripPressed { get; private set; } | |
| [] | |
| public ButtonControl triggerPressed { get; private set; } | |
| [] { "primary2DAxisClicked" })] | |
| public ButtonControl thumbstickClicked { get; private set; } | |
| [] { "primary2DAxisTouch" })] | |
| public ButtonControl thumbstickTouched { get; private set; } | |
| [] | |
| public Vector3Control deviceVelocity { get; private set; } | |
| [] | |
| public Vector3Control deviceAngularVelocity { get; private set; } | |
| protected override void FinishSetup() | |
| { | |
| base.FinishSetup(); | |
| thumbstick = GetChildControl<Vector2Control>("thumbstick"); | |
| trigger = GetChildControl<AxisControl>("trigger"); | |
| grip = GetChildControl<AxisControl>("grip"); | |
| primaryButton = GetChildControl<ButtonControl>("primaryButton"); | |
| secondaryButton = GetChildControl<ButtonControl>("secondaryButton"); | |
| gripPressed = GetChildControl<ButtonControl>("gripPressed"); | |
| thumbstickClicked = GetChildControl<ButtonControl>("thumbstickClicked"); | |
| thumbstickTouched = GetChildControl<ButtonControl>("thumbstickTouched"); | |
| triggerPressed = GetChildControl<ButtonControl>("triggerPressed"); | |
| deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity"); | |
| deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity"); | |
| } | |
| } | |
| } | |