Transplanting a Navmesh

By Clivewil, Edited by Dnamro

This tutorial is about re-using parts of one navmesh in another due to complexity/generation errors etc.

Note: This is an advanced tutorial. Experience editing navmeshes with 3dsmax or another 3d modeling tool is assumed.

often these objects - construction site, carrier, temple - are only connected at one area to the main mesh. the temple sometimes has 2 connections and i think the air terminal has 3. always put spawn points into said object before navmeshing regardless of whether you think it'll mesh the object or not; the debug islands it will create are helpful when aligning the imported (transplanted) object

i normally just import a mesh that has what i want, select the polys i need and delete the rest (if i was smarter i would save them all into a library file) - move it into position by eye and if there is any contention, err on the lower side, i.e. i have yet to have any errors caused by the navmesh being too low beneath the terrain, but have had several caused by it being too far above

in the attached pic, the navgen meshed the tan parts; my imported temple contained both the tan and red parts (but the mapper has added some crates and barrier blocks, as you can see. obviously this colouring is just for this demo; it should all be green) - i align the tan part of my temple to the tan part of the existing one, then remove the tan from the imported one, attach, and connect the polys. always check for incorrect open edges or isolated vertices afterwards

if you're worried about doing this by eye, remember that by using a high level of zoom in max you will be able to work to a much finer tolerance than the navmesh generator itself - just take a close look at some of the navgen's supposedly horizontal surfaces if you need confirmation of this.

Don't forget about the objects in the debug folders; they are handy guides because their positioning in the map is correct.  Look in folder:

NavMesh\work\[MapName]\GTSData\debug\objects\_by\_name\objects

Any object in the map will have a corresponding mesh in there. If the object, such as the upper part of the temple, only has a bounding box, you can import the whole object from here to aid in alignment/construction/error-checking, like in the above pic.

some troublesome objects may need a second or third (!) adjustment; because of this i remmed out the line bf2editor +loadMod %1 +loadLevel %2 +runConFileAndClose "saveQuadNoP4" +enableAsserts 0 +forceLoadPlugin SinglePlayerEditor in the SaveQuadLocal.bat file. this means no more opening/closing of the editor. with the editor open, i can just run FixNavmesh on my new meshes > Turn Off AI AND Navmesh > Load GTSdata > Turn On AI + Navmesh and see the changes in seconds rather than minutes. remember to save the new Quadtrees and aerialHeightMap though.

another handy thing is a bat file that launches the editor straight into your mod and map, i.e. in Kubra.bat:

f:

cd\BF2

F:\BF2\BF2Editor.exe +loadMod nav +loadLevel kubra\_dam

Ah! another application: the red part of this Zatar map was generated by itself and then transplanted onto the original - much quicker than generating the whole thing again. welding the edges was tricky though.