1
0

CameraTracker.cs 729 B

12345678910111213141516171819202122232425
  1. using System;
  2. using UnityEngine;
  3. namespace Tracking
  4. {
  5. public class CameraTracker: CalibratableTracker
  6. {
  7. public float LeanRotation { get; private set; }
  8. protected override string KeyPrefix => "cam";
  9. public KineticLegTracker legTracker;
  10. private void Update()
  11. {
  12. var adjustedRotation = RelativeRotation - legTracker.RelativeRotation;
  13. LeanRotation = -adjustedRotation.z; //left negative, right positive
  14. }
  15. private void OnGUI()
  16. {
  17. GUI.TextArea(new Rect(0, 400, 200, 90),
  18. $"LeanRotation: {LeanRotation}\nRelativeRotation: {RelativeRotation}\nRelativePosition: {RelativePosition}");
  19. }
  20. }
  21. }