Are Joints in fact Transforms?

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 …
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 :slight_smile: 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??


PS you have to wonder if “hugeBendablePurpleSausage.jpg” has ever existed as a filename before in this universe. A quick google gives fascinating matches :open_mouth:

Joints are Transforms. Typically animated ones. Each vertex in a mesh is transformed based on boneWeights.

So I am no expert in 3D graphics and Unity especially (given I’ve be using it for only the last 5 months). Yep I learn a lot on Unity Answers :slight_smile:

What I have done is write a multiple bone/multiple end effector IK solver for Unity - so I feel I know a little about this subject.

I think you need to consider two things: the skeleton and the skinned mesh attached to it.

When it comes to the skeleton a bone is effectively a combination of one end’s transform.localRotation and the localPosition of the subsequent child “end”'s transform. The magnitude of the localPosition as a vector is the length of the bone (and it is usually just down one axis so as not to confuse the calculation of the rotation which directs it - though apparently not always).

Now the skin is distorted by the position of the bones and the vertices of the mesh are affected by one or more bones in the skeleton - as configured by the 3D modelling package.

So yes - joints are just Transforms