I am trying to import a fbx-file with a skeleton. I got all the data and can import the mesh and bones correctly, this looks like this:
The problem occurs when I am trying to add weights and bindposes to the bones. The weights are correct, they deform the excepted vertices, but the mesh is deformed. See this picture:
The scales of the bones are all 1 and they are at the correct position. The hierarchy looks roughly like this:
TestObject
-------Hips
--------------L_Thigh
---------------------...
--------------Spine
---------------------...
--------------R_Thigh
---------------------...
-------MeshParent
--------------Mesh
And the code for setting the bindposes like this (simplified):
Transform[] boneTransforms = new Transform[numberOfBones];
Matrix4x4[] bindPoses = new Matrix4x4[numberOfBones];
for(int bi=0;bi<numberOfBones;bi++) {
boneTransforms[bi] = getBoneWithIndex(bi).transform;
bindPoses[bi] = boneTransforms[bi].worldToLocalMatrix* meshObject.transform.localToWorldMatrix;
//Other stuff (setting boneWeights, ...)
}
In every example I found the bindPoses were computed like this, so I am not really sure what I am doing wrong … Are the bindposes the problem? How do you compute them correctly? Has it something to do with the hierarchy?

