Animal AI running away from player

Hi, I’m new to Unreal Engine, and I want to do a scene, like a landscape, but an animated scene, with animals. So do you know how I could make an AI so the animal runs away from the player, when it comes too close. Would be great if you could send me pictures of a blueprint.

You need to look into AI behavior trees.
You can also find examples of this on the marketplace.

Here 5 simple steps that i use to make my fox run away from me :slight_smile:

  1. add to animal character collision sphere, that will trigger runaway event. Change it’s radius to 1000 or smth.
    this sphere allows my fox to understand who her enemy is (player), his location and rotation.

  1. when the player crosses the sphere, the fox must turn around before running. Or, easier - look in the same direction as the player.

  1. Each time, in order to run somewhere, the fox first must to turn there. Therefore I use function.

  1. Also, to start running, the fox must understand where to run. To do this, I use “Line trace by channel”, which makes a straight line from point A to point B, where A is fox location, and B - point to run (it can be impact point or trace end if there is no impact). “RunForward” var - it’s simple arrow u can add to ur animal. “RepeatRunAway” - custom event.

  1. So now, when fox know point to run - she need to rotate herself to that point, and - Runaway! After she achieve point to run, she need another one - then just launch “RepeatRunAway” event.

Good luck and have a nice animals:)

could you share an example project? please :frowning: I tried to implement but some settings are not working for me