How does an animator find its root object?

Generally speaking, an imported animated model has the following structure:

But if I move the Animator to any parent node, the animation can still play normally:

Is this behaviour by design or unexpected?

If it’s the design, how does the animator know which object is the root of the animation?

I can’t replicate the behavior you’re describing (if I understand what you’re saying). When I move an animator component to a parent object, any animation applied to the original root is also applied to the new root; however, any children of the original root break as their reference paths no longer function.

The root is always the object with the animator component.

Maybe this is different with animated models? I don’t have any to test at the moment; I just used some squares. I doubt this though, the way animations use string references seems consistent.

1 Like

Animators work with the names of objects. The Avatar created with a model import manages the list of bone names, and for Humanoids, allows animations to use a completely different bone name as long as it’s associated with a humanoid bone in their original avatar.

There is a “root” bone in the avatar, the bone that parents all other bones. When you allow your animation to apply root motion, it does not move the root bone but instead moves the object with the Animator component. Since all the other bones are still somewhere underneath that root, it all works visually identically, with the bonus that the object’s root (the thing with the animator) moves around even though it’s not the bone root listed in the animation.

2 Likes

No, you need some imported models (with an Avatar).

It seems that the “root” bone does not follow this rule, for example I can change the name to anything else, I can also add another node under the Animator node, but the animations still play.

This is mystical. It’s like there are some hidden rules for the Animator to find that “root” bone, and I want to know the process, such as the first known bone name on the child node or something else?

Yeah, I was wrong; don’t use 3D rigs all that much and shouldn’t have assumed.

I think the explanation halley gave makes perfect sense.

The root directory of a filesystem also has no name. That’s not really important. There’s always just one.

Find any Transform below the with a recognized bone name. Get its parent. If it’s null, we are broken. If that’s not a bone name we recognize, or if it has our Animator on it, it must be the root bone. Otherwise, get that parent’s parent. Repeat.

But remember, the Animator doesn’t move the root bone. It moves the Animator’d object.

1 Like