This commit is contained in:
2025-01-17 13:10:42 +01:00
commit 4536213c91
15115 changed files with 1442174 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
// 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.googlevr package.
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.XR;
namespace Unity.XR.GoogleVr
{
/// <summary>
/// A head-mounted display powered by Google Daydream.
/// </summary>
[InputControlLayout(displayName = "Daydream Headset", hideInUI = true)]
public class DaydreamHMD : XRHMD
{
}
/// <summary>
/// An XR controller powered by Google Daydream.
/// </summary>
[InputControlLayout(displayName = "Daydream Controller", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class DaydreamController : XRController
{
[InputControl]
public Vector2Control touchpad { get; protected set; }
[InputControl]
public ButtonControl volumeUp { get; protected set; }
[InputControl]
public ButtonControl recentered { get; protected set; }
[InputControl]
public ButtonControl volumeDown { get; protected set; }
[InputControl]
public ButtonControl recentering { get; protected set; }
[InputControl]
public ButtonControl app { get; protected set; }
[InputControl]
public ButtonControl home { get; protected set; }
[InputControl]
public ButtonControl touchpadClicked { get; protected set; }
[InputControl]
public ButtonControl touchpadTouched { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAcceleration { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
touchpad = GetChildControl<Vector2Control>("touchpad");
volumeUp = GetChildControl<ButtonControl>("volumeUp");
recentered = GetChildControl<ButtonControl>("recentered");
volumeDown = GetChildControl<ButtonControl>("volumeDown");
recentering = GetChildControl<ButtonControl>("recentering");
app = GetChildControl<ButtonControl>("app");
home = GetChildControl<ButtonControl>("home");
touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 44353112a58c73347adde914844b7642
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,241 @@
// 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.
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_OCULUS && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
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>
[InputControlLayout(displayName = "Oculus Headset", hideInUI = true)]
public class OculusHMD : XRHMD
{
[InputControl]
[InputControl(name = "trackingState", layout = "Integer", aliases = new[] { "devicetrackingstate" })]
[InputControl(name = "isTracked", layout = "Button", aliases = new[] { "deviceistracked" })]
public ButtonControl userPresence { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control leftEyeAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control leftEyeAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control leftEyeAngularAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control rightEyeAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control rightEyeAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control rightEyeAngularAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control centerEyeAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control centerEyeAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control centerEyeAngularAcceleration { get; protected 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>
[InputControlLayout(displayName = "Oculus Touch Controller", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class OculusTouchController : XRControllerWithRumble
{
[InputControl(aliases = new[] { "Primary2DAxis", "Joystick" })]
public Vector2Control thumbstick { get; protected set; }
[InputControl]
public AxisControl trigger { get; protected set; }
[InputControl]
public AxisControl grip { get; protected set; }
[InputControl(aliases = new[] { "A", "X", "Alternate" })]
public ButtonControl primaryButton { get; protected set; }
[InputControl(aliases = new[] { "B", "Y", "Primary" })]
public ButtonControl secondaryButton { get; protected set; }
[InputControl(aliases = new[] { "GripButton" })]
public ButtonControl gripPressed { get; protected set; }
[InputControl]
public ButtonControl start { get; protected set; }
[InputControl(aliases = new[] { "JoystickOrPadPressed", "thumbstickClick" })]
public ButtonControl thumbstickClicked { get; protected set; }
[InputControl(aliases = new[] { "ATouched", "XTouched", "ATouch", "XTouch" })]
public ButtonControl primaryTouched { get; protected set; }
[InputControl(aliases = new[] { "BTouched", "YTouched", "BTouch", "YTouch" })]
public ButtonControl secondaryTouched { get; protected set; }
[InputControl(aliases = new[] { "indexTouch", "indexNearTouched" })]
public AxisControl triggerTouched { get; protected set; }
[InputControl(aliases = new[] { "indexButton", "indexTouched" })]
public ButtonControl triggerPressed { get; protected set; }
[InputControl(aliases = new[] { "JoystickOrPadTouched", "thumbstickTouch" })]
[InputControl(name = "trackingState", layout = "Integer", aliases = new[] { "controllerTrackingState" })]
[InputControl(name = "isTracked", layout = "Button", aliases = new[] { "ControllerIsTracked" })]
[InputControl(name = "devicePosition", layout = "Vector3", aliases = new[] { "controllerPosition" })]
[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new[] { "controllerRotation" })]
public ButtonControl thumbstickTouched { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "controllerVelocity" })]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "controllerAngularVelocity" })]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "controllerAcceleration" })]
public Vector3Control deviceAcceleration { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "controllerAngularAcceleration" })]
public Vector3Control deviceAngularAcceleration { get; protected 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
{
[InputControl(aliases = new[] { "trackingReferenceTrackingState" })]
public new IntegerControl trackingState { get; protected set; }
[InputControl(aliases = new[] { "trackingReferenceIsTracked" })]
public new ButtonControl isTracked { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
trackingState = GetChildControl<IntegerControl>("trackingState");
isTracked = GetChildControl<ButtonControl>("isTracked");
}
}
/// <summary>
/// An Oculus Remote controller.
/// </summary>
[InputControlLayout(displayName = "Oculus Remote", hideInUI = true)]
public class OculusRemote : InputDevice
{
[InputControl]
public ButtonControl back { get; protected set; }
[InputControl]
public ButtonControl start { get; protected set; }
[InputControl]
public Vector2Control touchpad { get; protected 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>
[InputControlLayout(displayName = "Oculus Headset (w/ on-headset controls)", hideInUI = true)]
public class OculusHMDExtended : OculusHMD
{
[InputControl]
public ButtonControl back { get; protected set; }
[InputControl]
public Vector2Control touchpad { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
back = GetChildControl<ButtonControl>("back");
touchpad = GetChildControl<Vector2Control>("touchpad");
}
}
/// <summary>
/// A Gear VR controller.
/// </summary>
[InputControlLayout(displayName = "GearVR Controller", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class GearVRTrackedController : XRController
{
[InputControl]
public Vector2Control touchpad { get; protected set; }
[InputControl]
public AxisControl trigger { get; protected set; }
[InputControl]
public ButtonControl back { get; protected set; }
[InputControl]
public ButtonControl triggerPressed { get; protected set; }
[InputControl]
public ButtonControl touchpadClicked { get; protected set; }
[InputControl]
public ButtonControl touchpadTouched { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAcceleration { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularAcceleration { get; protected 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");
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 150936adb4fc13049a1001992b86c43e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,251 @@
// 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.
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_OPENVR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.XR;
namespace Unity.XR.OpenVR
{
[InputControlLayout(displayName = "OpenVR Headset", hideInUI = true)]
public class OpenVRHMD : XRHMD
{
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control leftEyeVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control leftEyeAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control rightEyeVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control rightEyeAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control centerEyeVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control centerEyeAngularVelocity { get; protected 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");
}
}
[InputControlLayout(displayName = "Windows MR Controller (OpenVR)", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class OpenVRControllerWMR : XRController
{
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisClick", "joystickOrPadPressed" })]
public ButtonControl touchpadClick { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
public ButtonControl touchpadTouch { get; protected set; }
[InputControl]
public ButtonControl gripPressed { get; protected set; }
[InputControl]
public ButtonControl triggerPressed { get; protected set; }
[InputControl(aliases = new[] { "primary" })]
public ButtonControl menu { get; protected set; }
[InputControl]
public AxisControl trigger { get; protected set; }
[InputControl]
public AxisControl grip { get; protected set; }
[InputControl(aliases = new[] { "secondary2DAxis" })]
public Vector2Control touchpad { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxis" })]
public Vector2Control joystick { get; protected 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>
[InputControlLayout(displayName = "Vive Wand", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class ViveWand : XRControllerWithRumble
{
[InputControl]
public AxisControl grip { get; protected set; }
[InputControl]
public ButtonControl gripPressed { get; protected set; }
[InputControl]
public ButtonControl primary { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisClick", "joystickOrPadPressed" })]
public ButtonControl trackpadPressed { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
public ButtonControl trackpadTouched { get; protected set; }
[InputControl(aliases = new[] { "Primary2DAxis" })]
public Vector2Control trackpad { get; protected set; }
[InputControl]
public AxisControl trigger { get; protected set; }
[InputControl]
public ButtonControl triggerPressed { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected 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>
[InputControlLayout(displayName = "Vive Lighthouse", hideInUI = true)]
public class ViveLighthouse : TrackedDevice
{
}
/// <summary>
/// An HTC Vive tracker.
/// </summary>
[InputControlLayout(displayName = "Vive Tracker")]
public class ViveTracker : TrackedDevice
{
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
}
}
[InputControlLayout(displayName = "Handed Vive Tracker", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class HandedViveTracker : ViveTracker
{
[InputControl]
public AxisControl grip { get; protected set; }
[InputControl]
public ButtonControl gripPressed { get; protected set; }
[InputControl]
public ButtonControl primary { get; protected set; }
[InputControl(aliases = new[] { "JoystickOrPadPressed" })]
public ButtonControl trackpadPressed { get; protected set; }
[InputControl]
public ButtonControl triggerPressed { get; protected 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>
[InputControlLayout(displayName = "Oculus Touch Controller (OpenVR)", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class OpenVROculusTouchController : XRControllerWithRumble
{
[InputControl]
public Vector2Control thumbstick { get; protected set; }
[InputControl]
public AxisControl trigger { get; protected set; }
[InputControl]
public AxisControl grip { get; protected set; }
// Primary & Secondary are switched in order to retain consistency with the Oculus SDK
[InputControl(aliases = new[] { "Alternate" })]
public ButtonControl primaryButton { get; protected set; }
[InputControl(aliases = new[] { "Primary" })]
public ButtonControl secondaryButton { get; protected set; }
[InputControl]
public ButtonControl gripPressed { get; protected set; }
[InputControl]
public ButtonControl triggerPressed { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisClicked" })]
public ButtonControl thumbstickClicked { get; protected set; }
[InputControl(aliases = new[] { "primary2DAxisTouch" })]
public ButtonControl thumbstickTouched { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; protected 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");
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a2cdc9fdde66bb49afa0763a7557ff9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,118 @@
// 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.windowsmr package.
#if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.XR;
namespace UnityEngine.XR.WindowsMR.Input
{
/// <summary>
/// A Windows Mixed Reality XR headset.
/// </summary>
[InputControlLayout(displayName = "Windows MR Headset", hideInUI = true)]
public class WMRHMD : XRHMD
{
[InputControl]
[InputControl(name = "devicePosition", layout = "Vector3", aliases = new[] { "HeadPosition" })]
[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new[] { "HeadRotation" })]
public ButtonControl userPresence { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
userPresence = GetChildControl<ButtonControl>("userPresence");
}
}
/// <summary>
/// A Windows Mixed Reality XR controller.
/// </summary>
[InputControlLayout(displayName = "HoloLens Hand", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class HololensHand : XRController
{
[InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(aliases = new[] { "triggerbutton" })]
public ButtonControl airTap { get; protected set; }
[InputControl(noisy = true)]
public AxisControl sourceLossRisk { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control sourceLossMitigationDirection { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
airTap = GetChildControl<ButtonControl>("airTap");
deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
}
}
[InputControlLayout(displayName = "Windows MR Controller", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
public class WMRSpatialController : XRControllerWithRumble
{
[InputControl(aliases = new[] { "Primary2DAxis", "thumbstickaxes" })]
public Vector2Control joystick { get; protected set; }
[InputControl(aliases = new[] { "Secondary2DAxis", "touchpadaxes" })]
public Vector2Control touchpad { get; protected set; }
[InputControl(aliases = new[] { "gripaxis" })]
public AxisControl grip { get; protected set; }
[InputControl(aliases = new[] { "gripbutton" })]
public ButtonControl gripPressed { get; protected set; }
[InputControl(aliases = new[] { "Primary", "menubutton" })]
public ButtonControl menu { get; protected set; }
[InputControl(aliases = new[] { "triggeraxis" })]
public AxisControl trigger { get; protected set; }
[InputControl(aliases = new[] { "triggerbutton" })]
public ButtonControl triggerPressed { get; protected set; }
[InputControl(aliases = new[] { "thumbstickpressed" })]
public ButtonControl joystickClicked { get; protected set; }
[InputControl(aliases = new[] { "joystickorpadpressed", "touchpadpressed" })]
public ButtonControl touchpadClicked { get; protected set; }
[InputControl(aliases = new[] { "joystickorpadtouched", "touchpadtouched" })]
public ButtonControl touchpadTouched { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
public Vector3Control deviceVelocity { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "gripAngularVelocity" })]
public Vector3Control deviceAngularVelocity { get; protected set; }
[InputControl(noisy = true)]
public AxisControl batteryLevel { get; protected set; }
[InputControl(noisy = true)]
public AxisControl sourceLossRisk { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control sourceLossMitigationDirection { get; protected set; }
[InputControl(noisy = true)]
public Vector3Control pointerPosition { get; protected set; }
[InputControl(noisy = true, aliases = new[] { "PointerOrientation" })]
public QuaternionControl pointerRotation { get; protected set; }
protected override void FinishSetup()
{
base.FinishSetup();
joystick = GetChildControl<Vector2Control>("joystick");
trigger = GetChildControl<AxisControl>("trigger");
touchpad = GetChildControl<Vector2Control>("touchpad");
grip = GetChildControl<AxisControl>("grip");
gripPressed = GetChildControl<ButtonControl>("gripPressed");
menu = GetChildControl<ButtonControl>("menu");
joystickClicked = GetChildControl<ButtonControl>("joystickClicked");
triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
touchpadTouched = GetChildControl<ButtonControl>("touchPadTouched");
deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
batteryLevel = GetChildControl<AxisControl>("batteryLevel");
sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
pointerPosition = GetChildControl<Vector3Control>("pointerPosition");
pointerRotation = GetChildControl<QuaternionControl>("pointerRotation");
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9231fc068a549684f8ece75b66d6095b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: