- Home /

# Understanding verts and triangles in Unity

Im trying to create a complex script which will analyse each of the vertex of a mesh and establish the vertices that are linked to that single vertex.

I was wondering if I took say index 5 through to 10 of a vert array, would taking the same 5 to 10 in a triangle array grab the correct triangle allowing me construct a small section of the original mesh?

Or am I completely misunderstanding the way meshes are constructed in unity?

vast discussion of these issues....

http://answers.unity3d.com/questions/193695/in-unity-is-there-a-fast-way-to-find-nearby-triang.html

**Answer** by DaveA
·
Oct 02, 2012 at 11:18 PM

This depends on what you mean by 'taking the same'

The triangle array contains indices into the vertex array. You cannot count on low-numbered vertices to be the first indexed by the triangle array. The first triangle in the array may be: [ 501, 1022, 44, ......

So if you want to take part of a mesh, you should look first to the triangle array. If you want a patch of triangles, you'll need to search the triangle array for matching edges (triangles that share two of the same vertices) and make a list of those.

Thank you I was misunderstanding the way meshes are constructed, it makes sence now!

### Your answer

### Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

### Follow this Question

### Related Questions

Having trouble implementing edge collapse operation with half-edge data structure 0 Answers

Easy way to convert a bunch of vertices to triangles or uv's? 1 Answer

Do i need recalculate uv coordinate after modifying mesh vertices 0 Answers

Color triangle on mesh 3 Answers

Procedural mesh creation issue 1 Answer