summaryrefslogtreecommitdiff
path: root/ActiveRagdoll/Assets/TABG/Scripts/Utils/Editor/DisplayAllJointsEditor.cs
blob: a8be3d6b9afb1e2f10e79ad2410e1cbe63def5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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<Transform>();

        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
            );
        }
    }
}