I have some simple mesh objects in my scene, and I want to obtain the position of each vertex in them. So far, I have the following code to do so.
MeshFilter mf = cube.GetComponent<MeshFilter>();
for (int i = 0; i < mf.mesh.vertices.length; i++)
{
Vector3 v = mf.mesh.vertices*;*
…
The problem is that this only obtains the local position of each vertex according to the unmodified mesh. (i.e., cubes will have vertices at (0.5, 0.5, 0.5), (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5) etc… no matter where the cube is in the scene.)
Is there any way to obtain the world position of these vertices instead of this useless local position?