Make object flee from another through a maze

I’m having an animal run through a maze and the player needs to catch it. I was able to get a code working that has the animal move away from player (very simple… really just pushes the animal in the opposite direction of player…)

What would you guys suggest be the best approach to making this situation work? With it being a tight maze, I think it might be best for the animal to follow waypoints through the maze so it looks more natural and like it actually knows where it’s going and doesn’t get stuck?

Could anyone point me to some tutorials somewhere that might help in setting this up? I was able to bake a NavMesh and get my animal walking on it, but now I need it to actually start following a path away from the player so the player can catch it.

Thanks!

Use the NavMeshAgent to move the animal.

Check the youtube if you don’t understand

Here’s a link to one

You will have to tweak the script to make it work for your animal.