Navmesh Creator

During the second year, we made three games in our own Engine. For the first game, Unity was used as a level editor and this conveniently allowed exporting navmeshes. For the second game however, my group decided to leave Unity behind and do everything ourselves in our engine/editor Cobra. One of the problems we had to solve was the creation of navmeshes.

I wrote a simple pipeline for the creation of navmeshes using Cobra and Maya.

Exporting the geometry from Cobra

The first step was exporting the actual walkable level geometry from Cobra. This was done by simply iterating over all of the walkable meshes in the current scene, then transforming the vertices to world space and saving the vertices and indices to a text file, which later was imported in maya.

A scene in Cobra

Creating the mesh in Maya

I wrote a small python script to import the text file exported from Cobra in to Maya. This was then used to create a mesh following the built in functions that existed in Maya.

Pseudo code for the creation of the mesh in Maya

Bridge_Overview_Maya.png

The mesh created by the script in Maya

Further polishing of the mesh

Since the mesh generated simply took all the vertices from the walkable meshes and created one big mesh from them, it wasn't directly suited for pathfinding. It was more meant to be used as a starting point for our level designerns to later polish in Maya, saving them a big portion of the time.

 

This was later combined with a tool created by Jonathan for manually enabling and disabling individual nodes on the corresponding navigation graph inside our Editor, giving us and the designers all the flexibility needed to relatively easy and fast create and update navmeshes.

Pathfinding with the navmesh 

Me and Jonathan implemented our pathfinding system (A-star) during the development of RoboCobra and you can read about our solution here.