Search Unity

How to Make NavMeshAgent AI Run away from an object

Discussion in 'Navigation' started by Mortalanimal, Dec 20, 2019.

  1. Mortalanimal

    Mortalanimal

    Joined:
    Jun 7, 2014
    Posts:
    568
    Hi, so I have an NavAgent, and this Agent Has a maximum and Minimum distance it cant shoot from. if the Target-Unit/object its trying to shoot is too close (Less than the minimum distance), I want my agent to increase the distance between them.

    Now, How do I do that, while;
    1) not fall of the map/Nav Mesh
    2) not move on top of other objects Obstacles
    3) Basically I want to use the Navmesh and not blindly increase my distance between my agent and the target

    There is an asset "A* path-finding" that can do this its for "100$", it does exactly what I want, how do I replicate it?

    Thanks in advance