Offset don't work when skeleton and effectors are not immediate childs of the animator

I was having a hard time trying to figure out why the timeline offsets weren't working. Everything seemed bugged to the core, and was looking for hack after hack that ultimately caused more trouble.
Ultimately I figured out that everything worked right if I made sure that the skeleton and the effectors of the character were the immediate childs of the object holding the animator.
It's not impossible that people will have another arrange than that one, and there's no warnning anywhere in the docs or a scripts that checks that's the case or something in the inspector to at least warn you. You should let people select wich transform the offsets and root should work upon, or at least tell people that it's never going to work if the hierarchy is not in set in the previously mentioned way.
So, to be clear:
animator > Esqueleton & Effectors [WORKS]
animator > yourTransform > skeleton & Effectors [BREAKS THE OFFSETS]
It may seem like a stupid comment, but I've seen people struggling with the same over the web, loosing hours like I did, just because there's no warnning anywhere.

1 Like

You are absolutely Right. It is not a stupid comment. Its a real concern.

Everything breaks if I add a transform in my character:
animator > yourTransform > skeleton

I need that transform in the middle.. to do my transform stuffs there, instead of the Root GameObject.

We fixed similar bugs to this semi-recently.

Please file a bug report with your Timeline and assets, and I'll look at it.

I can maybe also offer you a workaround until the bug gets fixed.

But these root motion problems are finnicky enough that I can't really give you a solution without seeing exactly what the problem is.

1 Like

You can reproduce it just by having a character with the aftermentioned structure:
animator> some transform > skeleton.
Try to set any offset, and you'll see that it will be impossible to control.
Personally I can change the structure, but some people won't be able to (Malbers beign one), I just wanted to let you guys know. At least you can put a warnning till it's solved, it takes some time to figure out what's happening.

I'm pretty sure it's fixable by adding an avatar that matches the hierarchy with the added joint. There are also other options to set related to the root joint.

You can try it for yourself, or you can send me the files and I can try it out.

[quote=“DavidGeoffroy”, post:5, topic: 848456]
I’m pretty sure it’s fixable by adding an avatar that matches the hierarchy with the added joint. There are also other options to set related to the root joint.
[/quote]
Yes the only issue with that is that all the animations are done with the old Avatar, without the added bone.
That Bone is a simple gameobject added in unity…

I’ll prepare some example files to show the issue :slight_smile:

[quote=“Malbers”, post:6, topic: 848456]
That Bone is a simple gameobject added in unity…
[/quote]

I understand that.

But root motion (and the Animator in general) is extremely sensitive to changes in hierarchy. There’s code in there that does pattern matching to match your actual hierarchy with your animations and your Avatar. It takes a best guess at where the root is, but there have been several bug reports where the decision is not working in all cases. This is even more complicated if you use Humanoid.

Some of these bugs are not fixable because changing the behaviour to fix one bug would create new bugs for other users. We are stuck with the auto-(not quite)-magic behaviour.

In general, you should avoid relying on this and make sure that your animations match your avatar and your actual hierarchy.

Especially if you ever create animations for that character in the Animation Window or Timeline, because you will be mix and matching clips with different hierarchies, which will cause more problems.

If you want to align content and hierarchy, you have a few options:

  • You can move the Animator to the actual animation root (and refer to it from the top-level GO’s components)
    or
  • remap the clips using AnimationUtility.GetEditorCurves/AnimationUtility.SetEditorCurves so that they match the target hierarchy
    or
  • Change the source FBX files and re-export so that the whole thing corresponds.

[quote=“Malbers”, post:6, topic: 848456]
I’ll prepare some example files to show the issue :slight_smile:
[/quote]

Thanks.
I know some bugs were fixed related to this, so if I have actual files, I can test them against the latest versions and see if it applies in your case.