Home > Blockchain >  How can I add NavMesh path to pass through the door in Unity
How can I add NavMesh path to pass through the door in Unity

Time:09-15

I am trying to use NavMeshAgent to move the player around in Unity.

But the doorway is not connected in NavMesh so the player can't pass through.

is there any way to add navmesh path at the doorway so that the player can go through?

I tried to change step height and max slop but does not work...

enter image description here

CodePudding user response:

you should use Nav Mesh dynamic for this, you need to add Nav Mesh obstacle to your door and make it non-static. also make sure that you have checked the "carve" .

Nav Mesh obstacle component

The agent can pass through the doorway if you open the door or move it up at run time. Make sure your character radious is thin enough as well and also adjust height of the agent if you want to move the door up.

Before opening the door

After Opening the Door

CodePudding user response:

I solved the issue by adding Off Mesh Link to the door object like @Voidsay suggested.

After adding the Off Mesh Link, it correctly shows the path and I can pass through the door.

enter image description here

Just selecting the floor objects both outside and inside the door to Start and End in Off Mesh Link did the trick. enter image description here

  • Related