Exemplo n.º 1
0
        private void FixMeshScaling(Transform toFix, float scale)
        {
            Vector3 Extents       = MeshUtil.GetMeshBounds(toFix.gameObject).extents;
            float   HighestExtent = 0.1f;

            if (Extents.x > HighestExtent)
            {
                HighestExtent = Extents.x;
            }
            if (Extents.y > HighestExtent)
            {
                HighestExtent = Extents.y;
            }
            if (Extents.z > HighestExtent)
            {
                HighestExtent = Extents.z;
            }

            float Scale = scale * 0.5f / HighestExtent;

            toFix.localScale = new Vector3(Scale, Scale, Scale);
        }