Get Avatar's bone Transforms in runtime

So, I’m trying to get Avatar’s bone Transforms.
Just like when you go to an - FBX model → Rig → Configure Avatar - and the whole bone Mapping appears. Then Hips, Spine, Chest etc are shown and let’s you change the bones Transforms… like here Unity - Manual: Importing a model with humanoid animations

Well, that while in runtime. Something I would do like that:
Transform bone = GetComponent().avatar.GetBone(BoneType.LeftShoulder);
or…
Transform bone = GetComponent().avatar.GetBone(“Left Arm/Shoulder”); // if it had a “path-like” hierarchy
or
Transform bone = GetComponent().avatar[“Left Arm/Shoulder”];

Is there a known way to do that? Is this available/possible?

1 Like

Bones are just transforms at runtime. So, you can use Transform.Find with a path to the bone you want.

1 Like

Well, that’s not exactly what I was looking for. Maybe I didn’t express myself properly.

Say the bone’s name (as a GameObject) is “L_Shoulder” or “Shoulder 01” or “potatoes”, whatever. And Unity has put it during auto-configuration in the Left Arm → Shoulder field.

Now, is there a way to ask for the Left Arm → Shoulder and return me the “L_Shoulder” Transform, whithout knowing the real name of the GameObject?

i dont have any code atm, but i was perusing this yesterday planning some IK stuff…

6 Likes

Yes, this is exactly what I needed. (I hope it works the way I need to)

Thank you big time!

1 Like