Navigation Meshes with Recast and Detour
Jotting down some notes on this from GSoC discussions before I (Mitchell) forget them.
Classes:
- NavMeshBuilder - requires recast, returns a NavMesh, a separate builder allows not needing recast at runtime if loading from BAM
- NavMeshNode - anchor the navmesh in the scene graph (ie. make the position of other things relative to it meaningful), and also to allow us to display a visual representation, the way one can visualize collision nodes
- NavMesh - stores the navmesh, not sure what else it actually does
- NavMeshQuery - queries a navmesh and follows Detour’s API (dtNavMeshQuery) (maybe gets merged into either NavMesh or NavMeshNode)
- Start with find_path() and find_straight_path()
- Skip sliced pathfinding and Dijkstra functions to start
- Look into local query options
Options for building a navmesh:
- Geom
- Heightfield
- Collision Mesh
- EGG
Rough outline of implementation:
- Review Recast demo for how to build a navigation mesh and Detour demo for how to query a navigation mesh
- Modify build systems to be able to build against Recast and Detour
- Includes CMake and makepanda systems
- These should be as two different libraries/plugins so we don’t have to include Recast in deployed applications
- NavMeshBuilder and Recast in one Panda library/plugin and NavMesh, NavMeshNode, NavMeshQuery, and Detour in the other
- Support building a nav mesh from a Geom
- Need to implement this in a way that can be expanded to other sources later
- Probably helps to get the NavMeshNode and debug visualization going at this point to be able to visualize the results of nav mesh building
- Implement NavMeshQuery with support for find_path() and find_straight_path()
- Support serialization of NavMeshes to/from BAM (this is important to avoid needing to build nav meshes at runtime)
- Should be usable at this point, collect feedback, fix some bugs, look toward expanding functionality
- Add more NavMeshBuilder sources (Heightfield may be the next most important source)
- Add more query options