How to make the navmesh agent accomplish one task per time?
I need a code that sets the destination of the navmesh agent to a point the player click on and, if there aren't any orders, to the nearest enemy. I created two functions : one that finds the position of the nearest enemy and one that find the point the player click on and they both work, but i can't make the code understand when the player's orders are accomplished/not given. Can someone give me some tips? Sorry for my poor english.
Answer by eskivor · Jun 15, 2017 at 08:26 AM
use a condition to check the distance between your agent and the player click destination (with Vector3.Distance (agentPosition, playerClickDestination)
), if it's inder a certain value, make the agent move to the neareest enemy
Your answer
Follow this Question
Related Questions
NavMeshAgent to rotate along the terrain 0 Answers
How to make the navmesh agent accomplish one task per time? 0 Answers
How to stop NavMeshAgent from using an area? 1 Answer
How to prevent AI from going Backwards 0 Answers
How to change speed for a cloned prefab instead of applying it to all instances of prefab? 1 Answer