|
I need to manipulate the vertex of a skinned mesh, but not its sharedMesh (beacuse it remain deformed also when i stop the game). How i can do?
(comments are locked)
|
|
Copy the mesh on startup, so that you're operating on the clone instead: I used with javascript: var newMesh : Mesh; function Start() { var oldMesh = GetComponent("SkinnedMeshRenderer").sharedMesh; newMesh = oldMesh; GetComponent("SkinnedMeshRenderer").sharedMesh = newMesh; } function Update () { var mesh : Mesh = GetComponent(SkinnedMeshRenderer ).sharedMesh; var vertices : Vector3[] = mesh.vertices; for (var i = 0; i < vertices.Length; i++) vertices[i] += Vector3.up * Time.deltaTime/100; mesh.vertices = vertices; mesh.RecalculateBounds(); } But when i stop the game in the editor the skidder mesh dont return to its original... is permanent modified.
May 05 '11 at 12:08 PM
Xarro92
With Instantiate it works very well, thank you!
May 05 '11 at 12:14 PM
Xarro92
(comments are locked)
|
