Ejemplo n.º 1
0
        public static void DrawBoxCollider(BoxCollider box, bool draw, Color color)
        {
            Transform transform = box.transform;

            if (draw && transform)
            {
                GizmosColorUtility.Push();
                Gizmos.color = color;

                var bounds = box.bounds;
                Gizmos.DrawWireCube(transform.position + box.center, box.size);

                GizmosColorUtility.Pop();
            }
        }
Ejemplo n.º 2
0
        public static void DrawBounds(Transform transform, Bounds bounds, bool draw, Color color)
        {
            if (draw && transform)
            {
                GizmosColorUtility.Push();
                Gizmos.color = color;

                //Gizmos.DrawLine(new Vector3(bounds.min.x, bounds.center.y, bounds.center.z), new Vector3(bounds.max.x, bounds.center.y, bounds.center.z));
                //Gizmos.DrawLine(new Vector3(bounds.center.x, bounds.min.y, bounds.center.z), new Vector3(bounds.center.x, bounds.max.y, bounds.center.z));
                //Gizmos.DrawLine(new Vector3(bounds.center.x, bounds.center.y, bounds.min.z), new Vector3(bounds.center.x, bounds.center.y, bounds.max.z));



                GizmosColorUtility.Pop();
            }
        }
Ejemplo n.º 3
0
 public static void DrawMeshs(GameObject go, bool draw, Color color, bool wire = true)
 {
     if (draw)
     {
         GizmosColorUtility.Push();
         Gizmos.color = color;
         var meshFilters = go.GetComponentsInChildren <MeshFilter>();
         foreach (var mf in meshFilters)
         {
             if (mf.sharedMesh != null)
             {
                 if (wire)
                 {
                     Gizmos.DrawWireMesh(mf.sharedMesh, mf.transform.position, mf.transform.rotation, mf.transform.GetGlobalScale());
                 }
                 else
                 {
                     Gizmos.DrawMesh(mf.sharedMesh, mf.transform.position, mf.transform.rotation, mf.transform.GetGlobalScale());
                 }
             }
         }
         GizmosColorUtility.Pop();
     }
 }
Ejemplo n.º 4
0
 public GizmosColorScope(Color color)
 {
     GizmosColorUtility.Push();
     Gizmos.color = color;
 }
Ejemplo n.º 5
0
 public void Dispose()
 {
     GizmosColorUtility.Pop();
 }