Changing NavigationPolygon2D during playtime

Godot Version

4.4

Question

hi i have a problem because i want to create bulidable walls to my game but i have problem setting up navigation, because if i am right you cannot simply rebake navigationpolygon during playtime it is baked only once. I dont want to use navigationobstacle2d because when i use them i still see that player just walks into it and slides on on the sides and i want it to actually find paths and not bump into things. Does anyone have idea how to handle this?

You can rebaked navmesh all you want at runtime. Only the performance cost is the limit and how much it costs and how feasible it is depends entirely on your scene and geometry setup.

NavigationObstacle2D by default only affect avoidance velocities. They do nothing for pathfinding. You would need to enable the affect_navigation_mesh property and rebake the navmesh to add the obstacle shape to the navmesh.