获取当前节点包含所有子物体的Bounds

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;
}

你可能感兴趣的:(获取当前节点包含所有子物体的Bounds)