- Home /
Question by
TamerCore · Feb 11, 2014 at 05:15 PM ·
mesh verticesmesh manipulationmesh colormesh-morph
How I can get InteractiveCloth vertices and apply to MeshFilter
Hi! Sorry for my english... this is my code
void Update() {
Mesh meshMy = GetComponent<MeshFilter>().mesh;
Vector3[] verticesMy = meshMy.vertices;
Vector3[] normalsMy = meshMy.normals;
Cloth mesh = GetComponent<InteractiveCloth>() as Cloth;
Vector3[] verts = mesh.vertices;
for (int i = 0; i < verts.Length; i++)
{
verticesMy[i] = transform.InverseTransformPoint(verts[i]);
}
meshMy.vertices = verticesMy;
meshMy.RecalculateNormals();
meshMy.RecalculateBounds();
}
I very need it, please do not ask why I need it +) this is not a game project.. I just need to apply this on my mesh...
this code works ALMOST =0) hehe ) but number of Cloth.vertices different from GetComponent().mesh.vertices;
How I can recalculate Cloth.vertices????? Is it possible? Thanx all...
Comment