Hi, I’ve been working on a rts using unity navigation and I was wondering if there was a way to stop 2 or more nav mesh agents fighting over the same destination.
for instance im using this click to move script to move 2 or more agents.
if(Input.GetMouseButtonDown (1) && selected == true)
{
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 100))
{
agent.SetDestination (hit.point);
anim.SetBool("walk",true);
}
}
and im using this when the agents reach there destination
if(agent.remainingDistance <= float.Epsilon)
{
anim.SetBool("walk",false);
}
is there a way to stop the agents from fighting over that one spot and just take the nearest available position.
If anyone could help it would be greatly appreciated.