diff --git a/README.md b/README.md new file mode 100644 index 0000000..773bd15 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Recast and Detour Navigation for Godot 4.3 + +## Incentive + +This provides an independent alternative to the navigation primitives of Godot 4.3 itself. + +Note: Although Godot already uses Recast to generate Navigation Meshes, I do not use the Godot NavigationMesh generator, as it doesn't allow me to use the Recast objects itself. I'd need to regenerate from the raw vertex data to the Recast primitives, which would lead to information loss. + +## Usage + + diff --git a/godot-cpp b/godot-cpp index a62f633..21d526e 160000 --- a/godot-cpp +++ b/godot-cpp @@ -1 +1 @@ -Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1 +Subproject commit 21d526e5e5b1e5d8b6be4db05a704c2c2e7837a9 diff --git a/src/RecastNavMesh.cpp b/src/RecastNavMesh.cpp index 315d0b2..88e59c5 100644 --- a/src/RecastNavMesh.cpp +++ b/src/RecastNavMesh.cpp @@ -113,11 +113,13 @@ bool godot::RecastNavMesh::init() { rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height); m_heightfield = rcAllocHeightfield(); if(!m_heightfield) { + log(RC_LOG_ERROR, "couldn't alloc heightfield!"); + return false; + } + if(!rcCreateHeightfield(this, *m_heightfield, config.width, config.height, config.bmin, config.bmax, config.cs, config.ch)) { + log(RC_LOG_ERROR, "couldn't build heightfield!"); return false; } - //if(!rcCreateHeightfield(m_ctx)) { - - //} // return false; } @@ -146,7 +148,7 @@ void godot::RecastNavMesh::cleanup() { */ } -void godot::RecastNavMesh::add_vertices(PackedByteArray vertices, unsigned char area_id) { +void godot::RecastNavMesh::add_vertices(PackedByteArray vertices, PackedByteArray indices, PackedByteArray area_id) { } diff --git a/src/RecastNavMesh.hpp b/src/RecastNavMesh.hpp index 0cadadf..2d8c717 100644 --- a/src/RecastNavMesh.hpp +++ b/src/RecastNavMesh.hpp @@ -150,7 +150,7 @@ public: bool init(); void cleanup(); void clear_vertices(); - void add_vertices(PackedByteArray vertices, unsigned char area_id); + void add_vertices(PackedByteArray vertices, PackedByteArray indices, PackedByteArray area_id); bool recalculate_navmesh(); bool is_calculated() { return m_calculated; } };