示例#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();
            }
        }
示例#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();
            }
        }
示例#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();
     }
 }
示例#4
0
 public GizmosColorScope(Color color)
 {
     GizmosColorUtility.Push();
     Gizmos.color = color;
 }
示例#5
0
 public void Dispose()
 {
     GizmosColorUtility.Pop();
 }