diff --git a/include/Gedeng/NavMesh.h b/include/Gedeng/NavMesh.h index 8de3d0f..a52143e 100644 --- a/include/Gedeng/NavMesh.h +++ b/include/Gedeng/NavMesh.h @@ -4,6 +4,13 @@ namespace Gedeng { +// A NavMesh can be constructed from the geometry in a node tree in order to be +// used for pathfinding. A typical scenario would go as follows: +// 1. Load Nodes using NodeSystem::load_nodes_from_disk +// 2. Create a NavMesh using NavMesh::create_from_nodes +// 3. Verify the resulting NavMesh via NavMesh::is_valid +// 4. Get a path between the desired points via NavMesh::get_path +// 5. Position an entity along this path via Path::get_interpolated_position class NavMesh { // Build the NavMesh from all collider geometry in the given node and all // its children. @@ -13,16 +20,15 @@ class NavMesh { // former `create_from_nodes` call) and its geometry is valid. bool is_valid() const; - // Return a valid path from a given Vector3 to a given Vector3. + // Return a valid and optimal path from a given Vector3 to a given Vector3. // If no valid path can be constructed, the returned path will be of size 1 // and contain only the `from` vector. - // The returned path may not be optimal -- if that is undesired, call - // `optimize_path` on the result. Path get_path(const Vector3 &from, const Vector3 &to) const; - // Optimize the given path to traverse the NavMesh as efficiently as - // possible. This can be slow! - void optimize_path(Path &path) const; + // Return any valid path from a given Vector3 to a given Vector3. + // This is more performant than `get_path`, but the returned path may not be + // optimal -- if that is undesired, call `get_path` instead. + Path get_unoptimized_path(const Vector3 &from, const Vector3 &to) const; }; } // namespace Gedeng \ No newline at end of file