-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawBones.cs
More file actions
30 lines (24 loc) · 827 Bytes
/
Copy pathDrawBones.cs
File metadata and controls
30 lines (24 loc) · 827 Bytes
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawBones : MonoBehaviour {
public bool draw = true;
void OnDrawGizmos() {
if (this.draw) { this.DrawChildBone(this.transform); }
}
void OnDrawGizmosSelected () {
this.DrawChildBone(this.transform);
}
void DrawChildBone (Transform t) {
Gizmos.color = Color.green;
for (int i = 0; i < t.childCount; ++i) {
this.DrawBone(t.position, t.GetChild(i).position, 0.1f);
this.DrawChildBone (t.GetChild(i));
}
}
void DrawBone (Vector3 a, Vector3 b, float size) {
Gizmos.DrawLine(a, b);
Gizmos.DrawWireCube(a, new Vector3(size, size, size));
Gizmos.DrawWireCube(b, new Vector3(size, size, size));
}
}