I've imported a number of track-terrain pieces into a game I'm working on, and I would like to get the mesh vertex arrays so I can position objects at their exact end. However, when I try to collect the arrays, they're off by a huge amount. A vertex located at the start of the object is 0,-0,-0.01 and a vertex located at the end of the object is.. 1, 0, 0.1. This doesn't seem to make any sense.
These are also -after- the coordinates are transformed into world space.
For a mesh that is 16 meters long and comprised of 70 points, I would expect vertex 65 to be at 3,0,16.
This is the code I am using to collect the information.
CurrentObject = Instantiate(TerrainObjects) as Transform; meshFilter = CurrentObject.GetComponent<MeshFilter>(); vertices = meshFilter.mesh.vertices; CurrentObject.transform.parent = gameObject.transform; //Vector3 EndVectorLocation = transform.InverseTransformDirection(vertices);
Have I missed something in getting the correct transform positions?