CameraTracker.cs 766 B

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