暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.googlevr package.
  3. #if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) && !DISABLE_BUILTIN_INPUT_SYSTEM_GOOGLEVR && !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 Unity.XR.GoogleVr
  8. {
  9. /// <summary>
  10. /// A head-mounted display powered by Google Daydream.
  11. /// </summary>
  12. [InputControlLayout(displayName = "Daydream Headset", hideInUI = true)]
  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" }, hideInUI = true)]
  20. public class DaydreamController : XRController
  21. {
  22. [InputControl]
  23. public Vector2Control touchpad { get; protected set; }
  24. [InputControl]
  25. public ButtonControl volumeUp { get; protected set; }
  26. [InputControl]
  27. public ButtonControl recentered { get; protected set; }
  28. [InputControl]
  29. public ButtonControl volumeDown { get; protected set; }
  30. [InputControl]
  31. public ButtonControl recentering { get; protected set; }
  32. [InputControl]
  33. public ButtonControl app { get; protected set; }
  34. [InputControl]
  35. public ButtonControl home { get; protected set; }
  36. [InputControl]
  37. public ButtonControl touchpadClicked { get; protected set; }
  38. [InputControl]
  39. public ButtonControl touchpadTouched { get; protected set; }
  40. [InputControl(noisy = true)]
  41. public Vector3Control deviceVelocity { get; protected set; }
  42. [InputControl(noisy = true)]
  43. public Vector3Control deviceAcceleration { get; protected set; }
  44. protected override void FinishSetup()
  45. {
  46. base.FinishSetup();
  47. touchpad = GetChildControl<Vector2Control>("touchpad");
  48. volumeUp = GetChildControl<ButtonControl>("volumeUp");
  49. recentered = GetChildControl<ButtonControl>("recentered");
  50. volumeDown = GetChildControl<ButtonControl>("volumeDown");
  51. recentering = GetChildControl<ButtonControl>("recentering");
  52. app = GetChildControl<ButtonControl>("app");
  53. home = GetChildControl<ButtonControl>("home");
  54. touchpadClicked = GetChildControl<ButtonControl>("touchpadClicked");
  55. touchpadTouched = GetChildControl<ButtonControl>("touchpadTouched");
  56. deviceVelocity = GetChildControl<Vector3Control>("deviceVelocity");
  57. deviceAcceleration = GetChildControl<Vector3Control>("deviceAcceleration");
  58. }
  59. }
  60. }
  61. #endif