Dynamic navmesh generation


I recently tried to accomplish this and had several problems, I also noticed there were many posts on the troubleshooting forums going back awhile all asking for example code or help solving the problem, there were very few solutions offered and no working examples the best suggestion was look at the MonkeyZone project which is out of date and according to some sources never actually worked path-finding wise anyway.

Once I got this working I created an example project that generates dynamic navmeshes to help others;

It can add new objects to the scene
It can then regenerate the navmesh and those new objects are included in the new navmesh

The navmeshes generated are identical to the meshes generated within the UI except that they can include dynamically added objects in the scene

It uses the Jaime model and can navigate to a clicked position anywhere on the terrain model
It includes physics

Does anyone know where I should put this?

It is to much code to post in the forums, I can zip it up and upload it to a website if that will help?

1 Like

the contributor repository maybe. or you can use github or googlecode.

a video will help us get a better view.

Anyway, i very interested in the way you ‘handle’ dynamic navmesh; what kind of dynamic is it?

You just regenerate the navmesh

or you doing something like this : http://www.mooncollider.com/dynamic-mesh/

or http://www.youtube.com/watch?v=te46WEAWjog

or CASA_Dynamic_ECM with voronoi

or Martin_Walsh_DynamicNavmesh with Polygon Subdivision

or Automated Navigation Mesh Generation Using Advanced Growth-Based Techniques http://gradworks.umi.com/3493710.pdf ?

Does jme have a graph class included for such algorithms? I thought no and included jgraph when i needed to record the users path. i wanted to spawn npcs on the way the user walked which follow him and i ended up creating the graph creation algorithm myself.

It is just an example for people trying to implement runtime navmeshes (so they can include more than just terrain) and get pathfinding to work using the AI library

what you choose to do with it after that is up to you including adding objects dynamically and regenerating paths on the fly like the links you provided demonstrate

The ai library doesnt support incremental additions or removals from a navmesh so the navmesh must be regenerated from scratch. In a normalish sized area this doesn’t have a huge performance impact and can be multi threaded to further reduce its impact

A video demonstrating a simple tutorial to help users would be a waste of time the code just generates navmeshes when prompted and can add in geometric objects and path around them and allows a BetterCharacterControl node to pathfind around the map

Ill just make a article about it with the source and project and post back a link here then if its used great, if not I tried.

There is a wiki here. Put the information and code there and it’ll be read. I know I’ll want to use navmeshes in my next project when I get around to it.