TrackedDevice.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. [Preserve]
  13. public class TrackedDevice : InputDevice
  14. {
  15. [InputControl(noisy = true)]
  16. [Preserve]
  17. public IntegerControl trackingState { get; private set; }
  18. [InputControl(noisy = true)]
  19. [Preserve]
  20. public ButtonControl isTracked { get; private set; }
  21. [InputControl(noisy = true)]
  22. [Preserve]
  23. public Vector3Control devicePosition { get; private set; }
  24. [InputControl(noisy = true)]
  25. [Preserve]
  26. public QuaternionControl deviceRotation { get; private set; }
  27. protected override void FinishSetup()
  28. {
  29. base.FinishSetup();
  30. trackingState = GetChildControl<IntegerControl>("trackingState");
  31. isTracked = GetChildControl<ButtonControl>("isTracked");
  32. devicePosition = GetChildControl<Vector3Control>("devicePosition");
  33. deviceRotation = GetChildControl<QuaternionControl>("deviceRotation");
  34. }
  35. }
  36. }