Best way to turn the head of a animated character?

I’m trying to write a script that will turn the head of NPCs in the environment to face the main character as he gets close to them. This isn’t hard at first glance, just a distance check then a LookAt.

The problem is that the NPC is animated. If they’re in the middle of a walk animation, the head bobs a little to fit the walk. The idle has the head turned down a bit. And since the character is animated, adjusting the rotation of its head in a script doesn’t really work.

I know I could just change the animation so the head is unaffected, but I like the animations the way they are, I just want to override it when the player character gets close. Is there a good way to do this?

Thank you!

Override the head rotation in LateUpdate().