private static Bounds CalculateBounds(Transform go) {
Bounds b = new Bounds(go.position, Vector3.zero);
UnityEngine.Object[] rList = go.GetComponentsInChildren(typeof(Renderer));
foreach (Renderer r in rList) {
b.Encapsulate(r.bounds);
}
return b;
}
网友评论