- Home /
Getting Triangles from Mesh
Is there an easy way to get an array or list with all the triangles of a mesh?
Comment
Best Answer
Answer by frogsbo · Aug 29, 2014 at 12:54 PM
function process_mesh ( meshobject : GameObject){
var mesh : Mesh = meshobject.GetComponent(MeshFilter).mesh;
var vtxArray : Vector3[]= mesh.vertices;
var mynormals: Vector3[] = mesh.normals;
var mytris: int[] = mesh.triangles;
search the reference for triangles and vertices for explanations, see morten nobles blog for procedurl mesh too.
Answer by EvilTak · Aug 29, 2014 at 12:55 PM
Use Mesh.triangles. You can look it up in the docs. It is basically the indices of the vertices to make tris.