FrontWheelTrackerEditor.cs 881 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using Tracking;
  3. using UnityEditor;
  4. using UnityEngine;
  5. [CustomEditor(typeof(FrontWheelTracker))]
  6. public class FrontWheelTrackerEditor : Editor
  7. {
  8. public override void OnInspectorGUI()
  9. {
  10. var fwt = (FrontWheelTracker) target;
  11. DrawDefaultInspector();
  12. if (!EditorApplication.isPlaying) return;
  13. EditorGUILayout.LabelField("Zero Rot:", fwt.ZeroRot.ToString());
  14. EditorGUILayout.LabelField("Zero Pos:", fwt.ZeroPos.ToString());
  15. EditorGUILayout.Space();
  16. EditorGUILayout.LabelField("Relative Position", fwt.Position.ToString());
  17. EditorGUILayout.LabelField("Relative Rotation", fwt.Rotation.ToString());
  18. EditorGUILayout.LabelField("Attach Vive Tracker to Wheel and press Button to calibrate");
  19. if (GUILayout.Button("Calibrate"))
  20. {
  21. fwt.Calibrate();
  22. }
  23. }
  24. }