0
\$\begingroup\$

I'm trying to make an agent patrol around a maze. The maze is proceduraly generated and consists of many rooms connected with doors. The problem occurs when the agent reaches a door. I wrote a script where if the agent gets near a door, the door opens, but the results are bad because the doors are walkable, so the navmesh doesn't consider them as obstacles and the agent gets stuck if the door opens and gets in its way.

I've been looking everywhere on the internet, but haven't found a solution. If anyone has an idea or a way to make this work, I'll be very thankful.

\$\endgroup\$
1
  • \$\begingroup\$ Why are the doors walkable? \$\endgroup\$ Commented Sep 20, 2018 at 14:00

1 Answer 1

2
\$\begingroup\$

I think what you're looking for is the NavMeshObstacle component.

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

https://docs.unity3d.com/ScriptReference/AI.NavMeshObstacle.html

\$\endgroup\$
1
  • \$\begingroup\$ This seems to be the correct answer, however for future readers I think it would improve if in addition to providing links, you could also describe why NavMeshObstacle is the right answer, and maybe a small example of how can someone use it. \$\endgroup\$ Commented Sep 20, 2018 at 14:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.