Rebuild NavMesh at runtime with the same NavMeshAgent but different Navigation > Agent parameters

Hello,

This is my first post on Unity’s forum so please, if you have any feedbacks on my post, I would be glad to hear them out.

I’m currently on a project where I take .ifc files to generate at runtime structures of buildings/houses in Unity.
I generate NavMeshSurface in the accessible floor areas.

My mission is to define a cylinder based agent (- you can scale his height and radius -) and then choose a startpoint and an endpoint to check if he can do the entire path with his dimensions (using NavMeshAgent.CalculatePath()).

I’m struggling to do it because I’m trying to access the NavMeshBuildSettings.agentRadius and the NavMeshBuildSettings.agentHeight of my existing NavMeshBuildSettings but it seems impossible at runtime.

I found another solution that would be creating a new NavMeshBuildSettings with new parameters ( - still in runtime - ) and then assign my existing NavMeshSurface ID and my NavMeshAgent ID with the new NavMeshBuildSettings.agentTypeID.
I have no problem creating NewSettings but when I try to modify the parameters, no modifications are taken in account.

I already found similar threads (i.e NavMesh.CreateSettings() not allowing changes ) saying that it was not possible to access NavMeshBuildSettings parameters.

Is there something I misunderstood in the NavMesh universe ? Do I need to go with another pathfinding solution like A* (A* Pathfinding Project Pro) ?

I’m still available if you need more informations.

Adrien

1 Like

You could try the navMesh surface component (Im assuming you bake the navmesh trough the navigation window) I personally dont use it but I think you can modify it at runtime.

Thanks for your reply.

I already use NavMeshSurface component in my project. I actually bake my first NavMesh at runtime after my application started. I can’t do it before since I need to load .ifc files in order to have 3D elements in my scene.

If you generate things like structures, use NavMeshObstacle

Thanks for your reply.

I have nothing more than floors, stairways and walls - with or without doorways - on my loaded 3D building.
I cannot just put a NavMeshObstacle (NVO) on a wall who has a doorway right ? Because of the shape of the NVO (Box/Capsule), Unity will not be able to see that there is a possibility to go through the doorway since the entire Box is considered as an obstacle.

I’m maybe forgetting something but I don’t think that NVO are a solution for my issue.

Did you find a solution to this? Struggling with the same issue currently.