ViveTrackerDebugDisplay.cs 763 B

123456789101112131415161718192021222324252627282930
  1. using TMPro;
  2. using Tracking;
  3. using UnityEngine;
  4. namespace Display
  5. {
  6. public class ViveTrackerDebugDisplay : MonoBehaviour
  7. {
  8. public TextMeshProUGUI posText;
  9. public TextMeshProUGUI rotText;
  10. public FrontWheelTracker tracker;
  11. private bool istrackerNull;
  12. // Start is called before the first frame update
  13. private void Start()
  14. {
  15. istrackerNull = tracker == null;
  16. }
  17. // Update is called once per frame
  18. private void Update()
  19. {
  20. if (istrackerNull || !tracker.isActiveAndEnabled) return;
  21. posText.text = $"Pos: {tracker.RelativePosition.ToString()}";
  22. rotText.text = $"Rot: {tracker.SteerRotation.ToString()}";
  23. }
  24. }
  25. }