As Cedric provided in this thread Debugging navmesh - #6 by Cedric. This to me implies that I can’t use obstacles other than in some really specific places, since my map can have over 128 obstacles easily… So I think I have to actually have the semi static obstacles already baked into the navmesh.
However, I have difficulties when recreating navmesh and trying to update the crowd, if some obstacle is added to the game. I’m currently recreating the navmesh with the same function as I created in the first place: navigation.createNavMesh(meshes, navmeshParameters)
If I do not update the crowd, it still works for some reason. But the new obstacle that I just recreated the navmesh for is not an obstacle in the navmesh and my character just walks through it. Not sure if this is a problem with me not updating the crowd… But I do not know how to actually do that! Do I have to dispose the crowd and then recreate it or what? Please advice
Still also skeptical about the fact that this takes +~0.5s to recreate the navmesh… Kind of requires that in the actual game things won’t disappear and appear so dynamically in the game world. For example, breaking a table would make the obstacle disappear and require navmesh recalculation… Whereas in my previous example it was just an obstacle in the navmesh and removing it would be really simple.
Have you tried to have ‘special’ non moving agents that act for some dynamic obstacles? I think it will be less precise than real obstacles but for the case you mentioned, it’s worth trying.
Doesn’t work if the object is not some regular shaped object like a square or circle, or if the object is very large… Otherwise I would consider it
Did you have any pointers for recreating the navmesh, since I don’t know what to do with crowd or how to fix the fact that added obstacles are ignored… I could make a playground if you got no ideas straight away
Here is a basic one with the setTimeout -function starting in line 110, that replaces the navmesh after 1 second:
However, I have no idea how to redo the crowd, since it seems to not react into the new updated navmesh at all? Even though the debug path shows it working correctly
It also seems that the obstacles are borked after the new navmesh is calculated… Yikes
Another question would be; could we split the navmesh into different parts that each have the 128 obstacle limit? And somehow say in which points your character can move from one navmesh to other.
Kind of managed to recreate the new crowd now as well:
Still seems to be some problem in my game with not so trivial case, can’t seem to recreate the navmesh so that the agents actually react to new obstacles