BendGoalInspector.cs 939 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;
  4. namespace RootMotion.Demos {
  5. /// <summary>
  6. /// Scene view helper for the LimbIK BendGoal
  7. /// </summary>
  8. [CustomEditor(typeof(BendGoal))]
  9. public class BendGoalInspector : Editor {
  10. private BendGoal script { get { return target as BendGoal; }}
  11. public override void OnInspectorGUI() {
  12. DrawDefaultInspector();
  13. }
  14. void OnSceneGUI() {
  15. if (script.limbIK == null) return;
  16. if (script.limbIK.solver.bone2 == null) return;
  17. if (script.limbIK.solver.bone2.transform == null) return;
  18. Handles.color = Color.cyan;
  19. Vector3 bonePosition = script.limbIK.solver.bone2.transform.position;
  20. Handles.DrawLine(script.transform.position, bonePosition);
  21. Inspector.SphereCap(0, script.transform.position, Quaternion.identity, 0.05f);
  22. Inspector.SphereCap(0, bonePosition, Quaternion.identity, 0.025f);
  23. Handles.color = Color.white;
  24. }
  25. }
  26. }