Ejemplo n.º 1
0
        public static Vector3[] ApplyScale(this MeshFilter mf, bool copy = true)
        {
            var m = mf.sharedMesh;

            if (copy)
            {
                m = Object.Instantiate(m);
            }
            var vs = m.vertices;

            for (int i = 0; i < vs.Length; i++)
            {
                vs[i] = mf.transform.TransformPoint(vs[i]);
            }
            m.vertices = vs;
            mf.ResetTransform();
            mf.sharedMesh = m;
            return(vs);
        }