- Home /
How to get the initial bone positions for a skinned mesh
I have a skinned mesh imported via fbx - this works fine on its own. However, I need to adapt the mesh and therefore retarget the rig slightly at runtime. From my understanding the SkinnedMeshRenderer has the bones as a set of Transform objects, and the mesh itself has boneWeights and bindPoses. I need to adapt the bone structure for the adapted mesh. I'm getting the bone positions in the Start() function of my script - but they seem to be offset from the mesh for some reason. If I just traverse through the bone hierarchy and retrieve the position value of each bone shouldn't that give me its bind position? If not, what is the correct way to find the bone locations for the bind pose? The bindPoses is the inverse bone transform (from the documentation), so I suspect this is not what I am looking for.
If I take the inverse of the bindpose matrix and multiply it by the point (0,0,0) I get the correct position. Perhaps the rig is not in its bind pose in the Start() function? Otherwise I would expect the inverse of the bindpose[i] matrix to give me the same as bones[i].position. Am I wrong here?
Your answer
Follow this Question
Related Questions
Combine Skinned meshes 2 Answers
Bones do not switch when called for (Find bones of player then replace clothes bones) 1 Answer
What space are the bones from an armature and the vertices of a mesh in? 1 Answer
How can I get the original bone bind position ( and not the matrix)? 1 Answer
Transfer bones from one Object to another (same meshes) 0 Answers