暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
  2. // Docs generation is skipped because these are intended to be replaced with the com.unity.xr.windowsmr package.
  3. #if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_WINDOWSMR && !UNITY_FORCE_INPUTSYSTEM_XR_OFF && !PACKAGE_DOCS_GENERATION
  4. using UnityEngine.InputSystem.Controls;
  5. using UnityEngine.InputSystem.Layouts;
  6. using UnityEngine.InputSystem.XR;
  7. namespace UnityEngine.XR.WindowsMR.Input
  8. {
  9. /// <summary>
  10. /// A Windows Mixed Reality XR headset.
  11. /// </summary>
  12. [InputControlLayout(displayName = "Windows MR Headset", hideInUI = true)]
  13. public class WMRHMD : XRHMD
  14. {
  15. [InputControl]
  16. [InputControl(name = "devicePosition", layout = "Vector3", aliases = new[] { "HeadPosition" })]
  17. [InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new[] { "HeadRotation" })]
  18. public ButtonControl userPresence { get; protected set; }
  19. protected override void FinishSetup()
  20. {
  21. base.FinishSetup();
  22. userPresence = GetChildControl<ButtonControl>("userPresence");
  23. }
  24. }
  25. /// <summary>
  26. /// A Windows Mixed Reality XR controller.
  27. /// </summary>
  28. [InputControlLayout(displayName = "HoloLens Hand", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
  29. public class HololensHand : XRController
  30. {
  31. [InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
  32. public Vector3Control deviceVelocity { get; protected set; }
  33. [InputControl(aliases = new[] { "triggerbutton" })]
  34. public ButtonControl airTap { get; protected set; }
  35. [InputControl(noisy = true)]
  36. public AxisControl sourceLossRisk { get; protected set; }
  37. [InputControl(noisy = true)]
  38. public Vector3Control sourceLossMitigationDirection { get; protected set; }
  39. protected override void FinishSetup()
  40. {
  41. base.FinishSetup();
  42. airTap = GetChildControl<ButtonControl>("airTap");
  43. deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
  44. sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
  45. sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
  46. }
  47. }
  48. [InputControlLayout(displayName = "Windows MR Controller", commonUsages = new[] { "LeftHand", "RightHand" }, hideInUI = true)]
  49. public class WMRSpatialController : XRControllerWithRumble
  50. {
  51. [InputControl(aliases = new[] { "Primary2DAxis", "thumbstickaxes" })]
  52. public Vector2Control joystick { get; protected set; }
  53. [InputControl(aliases = new[] { "Secondary2DAxis", "touchpadaxes" })]
  54. public Vector2Control touchpad { get; protected set; }
  55. [InputControl(aliases = new[] { "gripaxis" })]
  56. public AxisControl grip { get; protected set; }
  57. [InputControl(aliases = new[] { "gripbutton" })]
  58. public ButtonControl gripPressed { get; protected set; }
  59. [InputControl(aliases = new[] { "Primary", "menubutton" })]
  60. public ButtonControl menu { get; protected set; }
  61. [InputControl(aliases = new[] { "triggeraxis" })]
  62. public AxisControl trigger { get; protected set; }
  63. [InputControl(aliases = new[] { "triggerbutton" })]
  64. public ButtonControl triggerPressed { get; protected set; }
  65. [InputControl(aliases = new[] { "thumbstickpressed" })]
  66. public ButtonControl joystickClicked { get; protected set; }
  67. [InputControl(aliases = new[] { "joystickorpadpressed", "touchpadpressed" })]
  68. public ButtonControl touchpadClicked { get; protected set; }
  69. [InputControl(aliases = new[] { "joystickorpadtouched", "touchpadtouched" })]
  70. public ButtonControl touchpadTouched { get; protected set; }
  71. [InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
  72. public Vector3Control deviceVelocity { get; protected set; }
  73. [InputControl(noisy = true, aliases = new[] { "gripAngularVelocity" })]
  74. public Vector3Control deviceAngularVelocity { get; protected set; }
  75. [InputControl(noisy = true)]
  76. public AxisControl batteryLevel { get; protected set; }
  77. [InputControl(noisy = true)]
  78. public AxisControl sourceLossRisk { get; protected set; }
  79. [InputControl(noisy = true)]
  80. public Vector3Control sourceLossMitigationDirection { get; protected set; }
  81. [InputControl(noisy = true)]
  82. public Vector3Control pointerPosition { get; protected set; }
  83. [InputControl(noisy = true, aliases = new[] { "PointerOrientation" })]
  84. public QuaternionControl pointerRotation { get; protected set; }
  85. protected override void FinishSetup()
  86. {
  87. base.FinishSetup();
  88. joystick = GetChildControl<Vector2Control>("joystick");
  89. trigger = GetChildControl<AxisControl>("trigger");
  90. touchpad = GetChildControl<Vector2Control>("touchpad");
  91. grip = GetChildControl<AxisControl>("grip");
  92. gripPressed = GetChildControl<ButtonControl>("gripPressed");
  93. menu = GetChildControl<ButtonControl>("menu");
  94. joystickClicked = GetChildControl<ButtonControl>("joystickClicked");
  95. triggerPressed = GetChildControl<ButtonControl>("triggerPressed");
  96. touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
  97. touchpadTouched = GetChildControl<ButtonControl>("touchPadTouched");
  98. deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
  99. deviceAngularVelocity = GetChildControl<Vector3Control>("deviceAngularVelocity");
  100. batteryLevel = GetChildControl<AxisControl>("batteryLevel");
  101. sourceLossRisk = GetChildControl<AxisControl>("sourceLossRisk");
  102. sourceLossMitigationDirection = GetChildControl<Vector3Control>("sourceLossMitigationDirection");
  103. pointerPosition = GetChildControl<Vector3Control>("pointerPosition");
  104. pointerRotation = GetChildControl<QuaternionControl>("pointerRotation");
  105. }
  106. }
  107. }
  108. #endif