Vertex positions on a scaled GameObject

Hi!

I’m trying to get the vertex positions of a Mesh but I’m having a problem. If the object has a scale of (1,1,1) the vertex positions are right but if I scale the object to (20,20,20) the positions of the vertex are incorrect (they are in the 1,1,1 model positions). I tried with the transform.TransformPoint function but the result is the same.

What am I doing wrong? Thanks in advance

GameObject pista = GameObject.Find (“pruebas”);
Vector3[ ] vertices = pista.GetComponent ().mesh.vertices;

for (int x = 0; x < vertices.Length; x++) {

posicionVertice = vertices [×] + pista.transform.position;
GameObject esfera = GameObject.CreatePrimitive (PrimitiveType.Sphere);
esfera.transform.position = posicionVertice;
}

Its because the vertices need to stay in there original positions. Unity needs a list of the vertices you started with so it can then apply scale, rotation and translation to them. If it didn’t have the originals, everytime you changed scale, rotation or translation it would have to undo the old numbers back to the original, then multiply everything out to the new SRT positions. It is actually doing the scaling, but it does internally where you can’t see it.

Why are you needing the vertex positions?