Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Bounds findVesselBounds(Vessel ves)
- {
- Bounds retB = ves.parts[0].gameObject.GetRendererBounds();
- Vector3 min, max;
- min = retB.min;
- max = retB.max;
- foreach (Part p in ves.parts)
- {
- Bounds b = p.gameObject.GetRendererBounds();
- if (b.min.x < retB.min.x) { min.x = b.min.x; }
- if (b.min.y < retB.min.y) { min.y = b.min.y; }
- if (b.min.z < retB.min.z) { min.z = b.min.z; }
- if (b.max.x > retB.max.x) { max.x = b.max.x; }
- if (b.max.y > retB.max.y) { max.y = b.max.y; }
- if (b.max.z > retB.max.z) { max.z = b.max.z; }
- }
- retB.SetMinMax(min, max);
- log("VESSEL BOUNDS : " + retB.ToString());
- return retB;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement