GoogleVR.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #if UNITY_INPUT_SYSTEM_ENABLE_XR && !DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR && !PACKAGE_DOCS_GENERATION
  2. using UnityEngine.InputSystem.Controls;
  3. using UnityEngine.InputSystem.Layouts;
  4. using UnityEngine.InputSystem.XR;
  5. using UnityEngine.Scripting;
  6. namespace Unity.XR.GoogleVr
  7. {
  8. /// <summary>
  9. /// A head-mounted display powered by Google Daydream.
  10. /// </summary>
  11. [InputControlLayout(displayName = "Daydream Headset")]
  12. [Preserve]
  13. public class DaydreamHMD : XRHMD
  14. {
  15. }
  16. /// <summary>
  17. /// An XR controller powered by Google Daydream.
  18. /// </summary>
  19. [InputControlLayout(displayName = "Daydream Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
  20. [Preserve]
  21. public class DaydreamController : XRController
  22. {
  23. [InputControl]
  24. [Preserve]
  25. public Vector2Control touchpad { get; private set; }
  26. [InputControl]
  27. [Preserve]
  28. public ButtonControl volumeUp { get; private set; }
  29. [InputControl]
  30. [Preserve]
  31. public ButtonControl recentered { get; private set; }
  32. [InputControl]
  33. [Preserve]
  34. public ButtonControl volumeDown { get; private set; }
  35. [InputControl]
  36. [Preserve]
  37. public ButtonControl recentering { get; private set; }
  38. [InputControl]
  39. [Preserve]
  40. public ButtonControl app { get; private set; }
  41. [InputControl]
  42. [Preserve]
  43. public ButtonControl home { get; private set; }
  44. [InputControl]
  45. [Preserve]
  46. public ButtonControl touchpadClicked { get; private set; }
  47. [InputControl]
  48. [Preserve]
  49. public ButtonControl touchpadTouched { get; private set; }
  50. [InputControl(noisy = true)]
  51. [Preserve]
  52. public Vector3Control deviceVelocity { get; private set; }
  53. [InputControl(noisy = true)]
  54. [Preserve]
  55. public Vector3Control deviceAcceleration { get; private set; }
  56. protected override void FinishSetup()
  57. {
  58. base.FinishSetup();
  59. touchpad = GetChildControl<Vector2Control>("touchpad");
  60. volumeUp = GetChildControl<ButtonControl>("volumeUp");
  61. recentered = GetChildControl<ButtonControl>("recentered");
  62. volumeDown = GetChildControl<ButtonControl>("volumeDown");
  63. recentering = GetChildControl<ButtonControl>("recentering");
  64. app = GetChildControl<ButtonControl>("app");
  65. home = GetChildControl<ButtonControl>("home");
  66. touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
  67. touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
  68. deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
  69. deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
  70. }
  71. }
  72. }
  73. #endif