Dynamic Navmesh Implementation

Hey guys, I am working on a city-building game. The user can move around buildings and also create new ones. But the thing is, each time they do so, I have to regenerate my navmesh so that the citizens of the city won’t go through the buildings. As you know, recreating the navmesh is an expensive operation, so I was wondering how to I should solve this problem. I thought about using a worker thread, but I think it is not possible because worker threads do not have access to the DOM object. I am currently planning on using ajax but I decided to ask the pros first (that’s you) because I have little experience in game dev.
How would you solve this problem, how would you implement a dynamic navmesh?

Did a quick and dirty test using a worker:


Wow man, I am really grateful, thank you so much <33

@Raggar @Djani_Daud I can’t see the debugnavmesh changing in both playgrounds when repositioning a mesh… is there something wrong/missing?

Not sure why or where the issue is, as it seems the matrix is recomputed using the position and orientation in the worker - Before the navmesh is created, but After I apply the matrix from the main thread. Here’s a workaround, though: