Hi,
First, I’m sorry for my english, I’m french, I’ll do my best to express myself.
I have to change some triangles of a submesh into another one, when the player hit it.
That’s how I did it :
//TriInfo[2] is the index of the triangle in the submesh 0 I want to assign to the submesh 1
//GoMesh is the mesh I'm working on
//Define an Array wich will contain the triangles of the submesh 1 and the new one
int[] AddTriangle = new int[GoMesh.GetTriangles (1).Length + 3];
for (int i=0; i<GoMesh.GetTriangles (1).Length; i++){
AddTriangle_=GoMesh.GetTriangles(1)*;*_
* }*
_ AddTriangle[GoMesh.GetTriangles(1).Length]=GoMesh.GetTriangles(0)[TriInfo [2]*3];
AddTriangle[GoMesh.GetTriangles(1).Length+1]=GoMesh.GetTriangles(0)[TriInfo [2]*3 + 1];
AddTriangle[GoMesh.GetTriangles(1).Length+2]=GoMesh.GetTriangles(0)[TriInfo [2]*3 + 2];_
* //I assign the new array AddTriangle to the submesh 1*
* GoMesh.SetTriangles (AddTriangle, 1);*
It works, but it is a frequent request and, when the int[] gets long, the game lags.
It has to be a int[] and not a list (for the function SetTriangle), and i didn’t find a better way to add values to it.
Thank you for reading, and if you have a solution, i would be really grateful.