This may be a dumb question, or one already answered, but how can I make my NPCs walk offset from each other? My enemies are walking into each other or in a straight line to get to their common destination. I want them to act more like a squad, being more spread out to get to their point. Is there like a spread variable for the navmesh?
I am using the nav mesh agent to control where the NPCs are head towards, this is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class TargetFlag : MonoBehaviour {
public GameObject player;
NavMeshAgent agent;
// Use this for initialization
void Start ()
{
player = GameObject.Find ("Flag");
agent = gameObject.GetComponent<NavMeshAgent> ();
}
// Update is called once per frame
void Update ()
{
agent.SetDestination (player.transform.position);
}
}
Please tell me if there is more information I need to provide, thx
If this question has been answered, would you mind sharing the link?