Comments and answers for "Isolation of different vertices on a mesh"
http://answers.unity.com/questions/1302093/isolation-of-different-vertices-on-a-mesh.html
The latest comments and answers for the question "Isolation of different vertices on a mesh"Answer by slammin
http://answers.unity.com/answers/1302268/view.html
Every mesh has a MeshFilter. To access a GameObject's MeshFilter, use
MeshFilter mf = GetComponent< MeshFilter >();
Note that the code I'm providing might be incomplete depending on your circumstances.
Once you have the MeshFilter, you can access the MeshFilter's mesh's vertices and triangles:
mf.mesh.vertices
mf.mesh.triangles
It's probably best to copy these arrays into new arrays using the CopyTo command, the new arrays having respective lengths of mesh.vertices.length and mesh.triangles.length. Remember that the vertex array is a Vector3[] and the triangles array is an int[]. Let me re-iterate -- it's probably best that you create a copy of the original arrays (vertices and triangles) just so you don't lose the original data and then create one or more more set of arrays (vertices and triangles) that you can edit and assign to the mesh.
mf.mesh.vertices.CopyTo(array to copy to, 0);
mf.mesh.triangles.CopyTo(array to copy to, 0);
The vertex array (mf.mesh.vertices) is all of the vertices that compose the mesh. The tricky part is the triangle array (mf.mesh.triangles) which defines the triangles by pointing to specific vertices in the vertex array. Every triangle is composed of three points (three specific vertices in the vertex array). Therefore, the first triangle in the triangle array is defined by the first three entries (0, 1, 2) the second triangle is defined by the second three entries (3, 4, 5) and so on. If the first triangle is defined by the 3rd, 9th, and 12th vertex in the vertex array, then,
triangles array = (3,9,12,...);
Note that the order in which vertices are defined (clockwise or counterclockwise) is important as it determines which way the face of the triangle will be visible.
Once you are done editing the vertex array and triangles array you have to re-assign these two arrays to the mesh:
mf.mesh.Clear();
mf.mesh.vertices = the new vertex array;
mf.mesh.triangles = the new triangle array;
mf.mesh.RecalculateBounds();
mf.mesh.RecalculateNormals();
That is just the basics of it for a non-rotating, non-moving mesh. If you actually are creating a UI that can push and pull vertices, that is on you. To select vertices when left clicking on them you might want to create invisible spheres that are on each vertex and then useRaycasts to determine which sphere you are hovering over. Use input methods to determine when you left click and then you should be able to isolate which vertex you clicked on. There's some code to it. Hope I answered your question.
Good luck!Sun, 22 Jan 2017 08:13:42 GMTslamminAnswer by tanoshimi
http://answers.unity.com/answers/1302100/view.html
You edit the vertices as you want, and then assign the array back to [Mesh.vertices][1].
[1]: https://docs.unity3d.com/ScriptReference/Mesh-vertices.htmlSat, 21 Jan 2017 09:12:56 GMTtanoshimi