2
0

FrontWheelTrackerEditor.cs 1.1 KB

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