Animal run away

I can use A* Pathfinding Project Pro make animal run away like in video:
https://youtu.be/g04hPJg8WHc?t=6424 ?

When human move closer to the animal, it will run like in video.

Hi

If you use one of the built in movement scripts you could do something like this (in a separate script):

IAStarAI ai;

void Awake () {
	ai = GetComponent<IAstarAI>();
}

void Update () {
	if (player is close) {
		// Disable the automatic path recalculation
		ai.canSearch = false;
		if (do this regularly, every few seconds maybe && !ai.pathPending) {
			var pointToAvoid = player.position;
			// Make the AI flee from the enemy.
			// The path will be about 20 world units long (the default cost of moving 1 world unit is 1000).
			var path = FleePath.Construct(ai.position, pointToAvoid, 1000 * 20);
			ai.SetPath(path);
		}
	} else {
		ai.canSearch = true;
	}
}

Essentially it will check if the player is close, and if so: switch to using the FleePath movement type to try to get away from the player.

Thanks you very much