CameraTracker.cs 708 B

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