Rotate bone in LateUpdate not overriding animator?

I’m having a problem with scripted bone rotations not overriding the animator. My script is in LateUpdate. I am using 2018.3. The animation rig is “generic”.

The script to rotate the bones on its own works fine. But as soon as I add a layer to the Animation Controller with an animation clip for the same bones, the script is overridden and so no longer controls the target bone. Even if the Animator layer weight is set to 0 and even if there is no connection to the state in the Animator that holds the clip. All “Write Defaults” are unticked.

What I want to be able to achieve is to hand over control of the bones from script to animator and back again using a transition. So just turning off the animator is not really a possibility.

Any reason why a script in LateUpdate is not overriding the animator? The object with the bones is also a RigidBody, in case that has anything to do with it.

Thanks :slight_smile:

I`ve just found a simpler solution. Just set the update mode to “Animate Physics” in the Animator component and the scripted rotations should update properly =)

I’m having the exact same issue! Did you find a solution?

@davidcox70 I think this is because the animation controller takes over the rotations of the bone. This is how it works when you are using ragdolls also:

The short answer would be that you can’t change the rotation of a bone through script with the animator component controlling the head. This is because the bone is rotating then the animator component instantaneously changes the rotation. There is one method. You would have to create a new avatar asset contataining all the joints instead of the head. Then create a new layer in the animation controller that has that avatar applied. Now you need to create a duplicate of all the animations inside the main layer with all the parameters, transitions, blend trees, etc. applied. Now, whenever you want to animate the head through script then switch the layer to the new layer you created and it will continue the animations but instead with everything except for your head and you will have control over your head because the animation controller is moving everything in the avatar and that doesn’t include the head. I have not verified this answer but I think it will work. Hope that helps!