Animation overriding Nav Mesh Agent

Hopefully someone can help shed some light on this for me.

I have created an idle animation for the Enemy capsule, and was really happy with it. I have since found that the Enemy no longer gives chase when entering the chaseRange.

I am assuming that this is due to the position animation overriding the movement provided by the Nav Mesh Agent. I have tried enabling Apply Root Motion, and while this reinstates the chase mechanic from the Nav Mesh Agent, it also cancels out the rotations on all but the Y axis.

I have tried removing the Position property from the animation, which once again reinstates the chase mechanic, but prevents the Enemy from facing towards the player.

My rough idea for a workaround would be to possibly have the Nav Mesh Agent on a parent, and then have the Enemy capsule with animations as a child, although I’m not sure if this is the most efficient solution, or whether it would cause problems further down the line with code/triggers.

For now, I think I’ll simplify the animations and not do anything that involves rotation or position, so that I can continue with the lectures but any advice or suggestions on how to get this working would be appreciated.

Hi Chris,

That’s what I would have suggested. The animations are somewhat unpredictable. If you encounter issues, just move the animation part to a child game object and move the parent via code.

Thanks for the reply Nina, I’ll give this a go and let you know how I get on.

I tried to modify the existing objects to a parent/child setup, but I couldn’t get the behaviour I wanted (maybe I missed a setting or something). I deleted the entire Enemy game object, Animator Controller and Animations.

I created a new empty GameObject with the NavMeshAgent, then added gave it a child Capsule with a new Animator Controller and new Animations, which seems to be working so far. Thanks again for your reply.

Edit: I’ve noticed that this approach requires some changes to the code, hopefully I’m up to the challenge!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms