美文网首页
获取当前节点包含所有子物体的Bounds

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

作者: UnityAsk_1 | 来源:发表于2017-10-23 10:29 被阅读0次

    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

          本文链接:https://www.haomeiwen.com/subject/gnvouxtx.html