Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. public static Bounds findVesselBounds(Vessel ves)
  2.         {
  3.             Bounds retB = ves.parts[0].gameObject.GetRendererBounds();
  4.             Vector3 min, max;
  5.             min = retB.min;
  6.             max = retB.max;
  7.             foreach (Part p in ves.parts)
  8.             {
  9.                 Bounds b = p.gameObject.GetRendererBounds();
  10.                 if (b.min.x < retB.min.x) { min.x = b.min.x; }
  11.                 if (b.min.y < retB.min.y) { min.y = b.min.y; }
  12.                 if (b.min.z < retB.min.z) { min.z = b.min.z; }
  13.                 if (b.max.x > retB.max.x) { max.x = b.max.x; }
  14.                 if (b.max.y > retB.max.y) { max.y = b.max.y; }
  15.                 if (b.max.z > retB.max.z) { max.z = b.max.z; }
  16.             }
  17.             retB.SetMinMax(min, max);
  18.             log("VESSEL BOUNDS : " + retB.ToString());
  19.             return retB;
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement