暫無描述
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.

TrackedDevice.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334
  1. using UnityEngine.InputSystem.Controls;
  2. using UnityEngine.InputSystem.Layouts;
  3. using UnityEngine.Scripting;
  4. namespace UnityEngine.InputSystem
  5. {
  6. /// <summary>
  7. /// An input device that has its orientation and position in space tracked.
  8. /// </summary>
  9. /// <seealso cref="UnityEngine.InputSystem.XR.XRController"/>
  10. /// <seealso cref="UnityEngine.InputSystem.XR.XRHMD"/>
  11. [InputControlLayout(displayName = "Tracked Device", isGenericTypeOfDevice = true)]
  12. public class TrackedDevice : InputDevice
  13. {
  14. [InputControl(synthetic = true)]
  15. public IntegerControl trackingState { get; protected set; }
  16. [InputControl(synthetic = true)]
  17. public ButtonControl isTracked { get; protected set; }
  18. [InputControl(noisy = true, dontReset = true)]
  19. public Vector3Control devicePosition { get; protected set; }
  20. [InputControl(noisy = true, dontReset = true)]
  21. public QuaternionControl deviceRotation { get; protected set; }
  22. protected override void FinishSetup()
  23. {
  24. base.FinishSetup();
  25. trackingState = GetChildControl<IntegerControl>("trackingState");
  26. isTracked = GetChildControl<ButtonControl>("isTracked");
  27. devicePosition = GetChildControl<Vector3Control>("devicePosition");
  28. deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
  29. }
  30. }
  31. }