Created
February 7, 2018 00:40
Revisions
-
gekidoslair created this gist
Feb 7, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ using UnityEngine; namespace PixelWizards.Shared.Utilities { /// <summary> /// Debug draw bones in the editor /// </summary> public class ShowBones : MonoBehaviour { private Transform rootNode; private Transform[] childNodes; private void OnDrawGizmosSelected() { if (childNodes == null) { //get all joints to draw PopulateChildren(); } foreach (var child in childNodes) { if (child == rootNode) { //list includes the root, if root then larger, green cube Gizmos.color = Color.green; Gizmos.DrawCube(child.position, new Vector3(.1f, .1f, .1f)); } else { Gizmos.color = Color.blue; Gizmos.DrawLine(child.position, child.parent.position); Gizmos.DrawCube(child.position, new Vector3(.01f, .01f, .01f)); } } } private void PopulateChildren() { childNodes = transform.GetComponentsInChildren<Transform>(); } } }