sadrag
sadrag

Reputation: 575

Unity Navigation Agent; Target is reachable, but it can not find the way. (It's trying to get through the wall)

  1. I am using navmesh surface component.

  2. One surface, everywhere is Walkable (Green area in pic)

  3. There is a "Nav Mesh Modifier" component on the walls and doors. "Override area" is true and Area Type is Not Walkable.

  4. There are 12 agents in the field. They go randomly. (with NavMesh.SamplePosition.. There is no problem)

  5. An agent: Type= Humanoid, Speed= 6, Ang. Speed= 120, Acc = 20, Stop Dis.=0.. AutoBraking = true.

  6. Obstacle Avoidance: Radius=0.5, Height=2, Quality=High.. All agents have different Priority.

  7. Path Finding: Auto Trav. = true, Auto Repath=true.

Here is Problem:

All agents are fine. Randomly go. But -after a while- some times, one or more agents stuck. Actually, they are trying to get through the wall for go to destination. See the pic. (Red Capsule is agent, black mini sphere is target) It's trying to go straight when he has the possibility to go from the bottom. If I pull it backwards, it does not work. But it works when I drop it down.

I've tried a lot of things. What am I doing wrong? Please help..

Sample agent stuck..

Upvotes: 2

Views: 2240

Answers (1)

Guest User
Guest User

Reputation: 11

I also had a problem with this, but after looking around the unity documentation I have found the answer. This question is 4 months old but I will post my answer for future reference.

If you haven't already you add the component "Nav Mesh Obstacle" to the wall, you then tick the carve button. What is carve? It creates a hole in the nav mesh pretty much for better navigation. It works even if you un-tick the carve box but sometimes it will get stuck to the walls.

https://docs.unity3d.com/Manual/class-NavMeshObstacle.html

The link above explains more about it. Check it out if you still don't understand!

Upvotes: 1

Related Questions