Question

In my game, all player and monster characters have a NavMeshAgent component, when one character moves to another, it will push away the second one.

I read the unity docs of NavMeshAgent, found the problem is affected by Obstacle Avoidance Type and Avoidance Priority, I have tried this, but still cannot have a perfect solution, I need the characters DO NOT push each other away and still take others as obstacles.

Please give me some advice how to use NavMeshAgent well and resolve this problem. thanks in advance.

Was it helpful?

Solution

Give this article a try, it helped me, should help you too: Pathfinding and Local Avoidance for RPG/RTS Games using Unity

OTHER TIPS

I know that this is an old question, but since I had the same issue recently and I found a solution, I diceded to post my fix just in case anyone else has the same issue.

Basically in the NavMeshAgent component there is a section for Obstacle Avoidance which contains a property named Quality. The fix is to set the Quality to 'None'. The description of 'Quality' based on Unity is that "Higher quality avoidance reduces more the chance of agents overlapping but it is slower to compute than lower quality avoidance." With other words setting to 'None' it will stop the agents from pushing each other.

enter image description here

That means it will avoid the Player too if the player is under the same Agent Type. What you can do is to check the distance between the enemy and the player and have a range where the enemy can know if the player is close enough to attack.

I personally have't tried this method, but it can help you. http://forum.unity3d.com/threads/navmesh-and-raycast-obstacle-avoidance.135090/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top