localToWorld gives wrong value if the mesh was transformed by skeleton

I need to get the coords of all the vertices of a geometry in world space,if the mesh was transformed by its skeleton,the localToWorld function will give wrong value,all the coords of the vertices were not affected by the transform of the skeleton.

The bone transform does not happen automatically when using localToWorld(). However you can try to apply it by using SkinnedMesh.boneTransform() before using localToWorld(). You have to call boneTransform() with two parameters: The vertex index and and target vector that will hold the transform vertex in local space as the result.