- Home /
The question is answered, right answer was accepted
Group Movement (RTS style) using Unity Pro NavMesh
I have a game in the works that is based off of some maps that I used to play in Age of Empires 2 such as Castle Blood. Using Unity's navigation mesh works great for moving one or two units around. If a group of let's say 20 units is tasked to the same spot, they won't all reach the destination, ever. They'll keep moving and moving and moving forever, trying to push through each other but never succeeding in making it through to the center where the destination is. I have a temporary solution where if the units haven't moved a certain distance in a certain amount of time, it will stop trying to move. What I would like is just for the units to give up on their own without the extra code. This problem also happens if tasked outside the navmesh. They will reach the edge and keep trying to move. Does anyone know of a better way to do this? Note that the destination is only being set once so it's not a problem of the destination being sent repeatedly.
Fixed by offsetting each unit's destination based on where each one is from the first selected unit. To solve the problem of getting far-away units closer when multiple units are selected I'll have to code in formations.
Follow this Question
Related Questions
RTS Movement - I'm doing it wrong 2 Answers
Move an Object to a separate area/NavMesh 0 Answers
Click to Move With Navmesh 0 Answers
Navmesh Agent Path Not Updating 1 Answer
Can't get player to walk to object using NavMeshAgent 1 Answer