How to resize mesh to fbx model gameobject?

Hi, I’m using the mesh filter and renderer to get a hold of the vertices of the mesh and assign spheres to the mesh, but I’m using an fbx model which has a skinned mesh renderer by default. I’ve managed to assign spheres to each vertex but the mesh itself doesn’t match the size or the rotation of the actual model.

99069-screen-shot-2017-08-03-at-041425.png

I want to assign the spheres to the textured fbx model like in the image but i can’t get the vertex information from it. I read on other posts about SkinRenderer.BakeMesh(), but I have no idea how to use it because the document is really ambiguous on how to use it. I have an array of vertices which I get from mesh.vertices. I tried changing the size and rotation in the blend file that it was made in but no difference. I also tried to putting the mesh in an empty gameobject and resizing it that way but the result is the same.
Thanks!

The mesh.vertices array gives the local position of the vertices which is relative to the center of the object. And seems like you are trying to assign your spheres at those positions and the position you are passing is world position which is why they are not at correct positions. Use [Transform.TransformPoint][1] to convert local position of your vertices to world position and pass that position to your spheres.

Considering the script is assigned to your model itself below is an untested code but should give you the idea.

for(int i = 0; i < mesh.vertices.Length; i++) {
    // Here the position is transformed based on which object the script is attached to.
    sphere.transform.position = transform.TransformPoint(mesh.vertices*);*

}
[1]: Unity - Scripting API: Transform.TransformPoint