I am well into writing the new AI tutorial but since I have not developed a 3d game before I am reduced to what my instincts tell me to do when passing the navMesh around and I don’t want to mislead readers if I am wrong.
Please correct me if anything below is better done a different way.
For a production game I would add the pre-generated navigation meshes to the assets folder. I do this now by storing the geometry in a .j3o.
My instincts tell me to load the Mesh into the Spatials UserData upon its creation so that when the pathfinding control is added to the spatial, all it does is grab it from UserData.
//load navMesh into spatial UserData charNode.setUserData(DataKey.NAVMESH, loadNavMesh(DataKey.NAVMESH).getMesh());
This means each spatial can have its own navigation mesh. Which is desirable since some NPC’s may need a custom mesh based off their size. assetManager will also clone duplicate meshes which is also desirable.
Any comments are appreciated.