This commit is contained in:
Tim Blume 2024-06-16 14:19:56 +02:00
parent 25056fd5e8
commit b7a203f1b9
4 changed files with 19 additions and 6 deletions

11
README.md Normal file
View file

@ -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

@ -1 +1 @@
Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1 Subproject commit 21d526e5e5b1e5d8b6be4db05a704c2c2e7837a9

View file

@ -113,11 +113,13 @@ bool godot::RecastNavMesh::init() {
rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height); rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height);
m_heightfield = rcAllocHeightfield(); m_heightfield = rcAllocHeightfield();
if(!m_heightfield) { 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; return false;
} }
//if(!rcCreateHeightfield(m_ctx)) {
//}
// //
return false; 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) {
} }

View file

@ -150,7 +150,7 @@ public:
bool init(); bool init();
void cleanup(); void cleanup();
void clear_vertices(); 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 recalculate_navmesh();
bool is_calculated() { return m_calculated; } bool is_calculated() { return m_calculated; }
}; };