Beispiel #1
0
        public static void UpdateSkinnedMeshApproximateBoundsFromBoundsStatic(List <GameObject> objectsInCombined, SkinnedMeshRenderer smr)
        {
            Bounds b    = new Bounds();
            Bounds bigB = new Bounds();

            if (MB_Utility.GetBounds(objectsInCombined[0], out b))
            {
                bigB = b;
            }
            else
            {
                Debug.LogError("Could not get bounds. Not updating skinned mesh bounds");
                return;
            }
            for (int i = 1; i < objectsInCombined.Count; i++)
            {
                if (MB_Utility.GetBounds(objectsInCombined[i], out b))
                {
                    bigB.Encapsulate(b);
                }
                else
                {
                    Debug.LogError("Could not get bounds. Not updating skinned mesh bounds");
                    return;
                }
            }
            smr.localBounds = bigB;
        }
Beispiel #2
0
        public static void UpdateSkinnedMeshApproximateBoundsFromBoundsStatic(List <GameObject> objectsInCombined, SkinnedMeshRenderer smr)
        {
            Bounds bounds      = default(Bounds);
            Bounds localBounds = default(Bounds);

            if (MB_Utility.GetBounds(objectsInCombined[0], out bounds))
            {
                localBounds = bounds;
                for (int i = 1; i < objectsInCombined.Count; i++)
                {
                    if (!MB_Utility.GetBounds(objectsInCombined[i], out bounds))
                    {
                        Debug.LogError("Could not get bounds. Not updating skinned mesh bounds");
                        return;
                    }
                    localBounds.Encapsulate(bounds);
                }
                smr.localBounds = localBounds;
                return;
            }
            Debug.LogError("Could not get bounds. Not updating skinned mesh bounds");
        }