- Home /
Why is the bindposes matrix not immediately equal to the bone representation?
I am attempting to combine skinned mesh renderers into one object (seperate materials), preserving animation. I have seen several scripts and questions on how to do this and have cobbled together something of my own. I have been working on this for hours now, and I cannot get the model to not look like a praying mantis of sorts, even when I only use one skin and just try to reproduce it.
After narrowing out about everything else, I am getting perplexed by the bindposes matrix. Every script I have seen ends up with something like the line:
listBindPoses.Add( bonesFinal[b].worldToLocalMatrix * bonesFinal[b].parent.localToWorldMatrix );
However, even directly after instantiating the object, the bindposes matrix of my skin does not equal bones.worldToLocal x bones.parent.localToWorld, or any combination of yida.worldToLocal x yada.localToWorld that I can find.
I would love some intuition as to why bindposes is not what I expect. Does it represent the bones in some model space which is not reflected in the bones themselves? If so, how do I account for this? Grab it at the start of the script and multiply it in later as an extra factor for the bindposes?
Code is attached; I didn't want to clutter the question, but if it could help others I would like it to do so.
The model looks most normal when I ins$$anonymous$$d set the bindposes matrix to be:
bindPoses = bone.worldToLocal$$anonymous$$atrix * originalSkinned$$anonymous$$eshRenderer.transform.localToWorld$$anonymous$$atrix;
Even then, the model is stretched and awkward. I am under the impression this works because of the close relationship between the gameObject the skinned$$anonymous$$eshRenderer came from and whatever object I should be using to get the local to world transformation.
Your answer
Follow this Question
Related Questions
How to calculate nearest bones, weights and bindposes programmatically? 0 Answers
Problem with exporting skinning-data from 3ds Max to Unity 1 Answer
Help needed with combining skinned mesh bindposes 1 Answer
Changing mesh on SkinnedMeshRenderer causes deformation 1 Answer
Can we get skinnedMeshRender.bones in unity source after choose optimize game object? 0 Answers