From 63546b0dc7b142b30b090257f523bc9a9e13b36b Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:02:11 +0800 Subject: + model --- .../Scripts/Utils/Editor/DisplayAllJointsEditor.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs (limited to 'ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs') diff --git a/ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs b/ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs new file mode 100644 index 0000000..a8be3d6 --- /dev/null +++ b/ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +[CustomEditor(typeof(DisplayAllJoints))] +public class DisplayAllJointsEditor : Editor +{ + + protected void OnSceneGUI() + { + DisplayAllJoints display = (DisplayAllJoints)target; + + Transform[] childrens = display.gameObject.GetComponentsInChildren(); + + for (int i = 0; i < childrens.Length; ++i) + { + Transform child = childrens[i]; + if (child == display.transform) + { + continue; + } + Transform transform = child.transform; + Handles.color = Handles.xAxisColor; + Handles.ArrowHandleCap( + 0, + transform.position, + transform.rotation * Quaternion.LookRotation(Vector3.right), + display.size, + EventType.Repaint + ); + Handles.color = Handles.yAxisColor; + Handles.ArrowHandleCap( + 0, + transform.position, + transform.rotation * Quaternion.LookRotation(Vector3.up), + display.size, + EventType.Repaint + ); + Handles.color = Handles.zAxisColor; + Handles.ArrowHandleCap( + 0, + transform.position, + transform.rotation * Quaternion.LookRotation(Vector3.forward), + display.size, + EventType.Repaint + ); + } + } +} -- cgit v1.1-26-g67d0