Search Unity

Navmeshagents don't follow player and group up

Discussion in 'Navigation' started by olliewe88, Feb 14, 2019.

  1. olliewe88

    olliewe88

    Joined:
    Dec 4, 2015
    Posts:
    11
    Been having this issue for a while now. When there are lots of enemies some of them group up and don't follow a player. Then after a few seconds, they goto where the player was. All I want them to do is to chase the player.
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Your images are unfortunately broken, but there's a few things that might be happening.
    Most likely the grouping up is more that all the agents block each other off since they also try to avoid each other. This could result in them staying close together and not really moving.

    How you could fix this is by actively grouping individual agents together when they get close to each other, and then have the group path as one. Basically each agent turns its NavMeshAgent off while a group Agent is started up, the group agent calculates a path and moves, and the individual agents simply move along without using their navmeshagents.