- Home /
The question is answered, right answer was accepted
Mesh.triangles specification
I am trying to make a simple mesh from scratch with the Mesh class that is used in Mesh Filter component.
The problem - I do not understand how the triangle array works! Is it a continuous stream of vertex indices?? Why aren't triangles grouped in integer Vector3s?
So if I had 4 vertices with indices 0,1,2,3 - how would the triangle array look, to make two triangles from 0,1,2 and 1,2,3 (to form a square out of 2 triangles)?!
Answer by Sven Frankson · Jun 20, 2014 at 11:37 AM
Hi,
[0,1,2,2,3,0]
Picture your triangles array as a succession of int[3].
Also, [0,1,2] is the triangle where you read 0, 1, 2 in a clockwise rotation.
You might want/need to read it http://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html .
Thanks a lot! $$anonymous$$aybe I screwed up the coordinates, didn't work at first, but now it's fine!