Someone said to me: So, if you import a model with joints to Unity3D, it looks like the joints are in fact “Transforms”. Is that correct?
I said “Sure, you can see here, there’s a joint, click on the game object. The only component is a Transform. In fact when you change the rotation that’s you bending the elbow. It would appear that a ‘joint’ is just a Transform and that’s it. Or you could say it is ‘stored as’ a Transform and that’s it.”
Then I thought about this and said “I better check with someone smarter…”
So indeed … is a Joint quite simply “a Transform” … and that’s it?
Is there any behind the scenes magic?
Now further on this …
say you have two sausages (“L” and “R”), joined by a joint such that you can elbow the joint.
now, on the skinned mesh renderer of both “L” and “R”, there will be shown in the component a root joint, call it “r”
now, the joint “r” will in fact have a couple of joints as children underneath it.
here …
If you rotate the join “r”, it will just spin the “whole” object (L+R). {Aside - as far as I know, that is always the case … actually maybe not? Maybe sometimes spinning the root joint does nothing?}
But, one of the joints underneath “r” will in fact be, the famous joint between the two sausages. If you change the rotation on that joint (in fact it’s labelled joint6 in the example shown), that then is you changing the elbow of the model. Hooray!
So … this makes me think … where the heck is that magic information kept? We can see that “r” is simply kept as the “Root Bone” in the skinned mesh renderer. But, where are the other two bones kept / where is it notated which one is the elbow? IE, what magic makes joint6 the elbow joint?
In fact – glancing at the RTFM – I assume that it’s SkinnedMeshRenderer.bones ?
Or is it more something to do with the bindposes ?
(As a relatively minor side question … which one’s the “root” bone? is it simply the 0 index of the four?)
(Note that the field “Root Bone” in the editor happens to be undocumented …
http://unity3d.com/support/documentation/Components/class-SkinnedMeshRenderer.html
and it does not apparently really exist in the api, that editor panel must just figure it out from somewhere.)
Furthermore, this all appears to be totally undocumented in the Unity documentation? (a) is that correct, it’s a huge hole in the doco about the only interesting part of the product or is the doco somewhere I don’t know? and (b) has some friendly Internaut produced the “missing manual” for Unity that explains all this??
Cheers!!
PS you have to wonder if “hugeBendablePurpleSausage.jpg” has ever existed as a filename before in this universe. A quick google gives fascinating matches