summaryrefslogtreecommitdiff
path: root/modules/recast/navigation_mesh_generator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/recast/navigation_mesh_generator.cpp')
-rw-r--r--modules/recast/navigation_mesh_generator.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/recast/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp
index 0cac07e3e7..14467dc5c7 100644
--- a/modules/recast/navigation_mesh_generator.cpp
+++ b/modules/recast/navigation_mesh_generator.cpp
@@ -45,6 +45,10 @@
#include "scene/resources/shape.h"
#include "scene/resources/sphere_shape.h"
+#ifdef MODULE_CSG_ENABLED
+#include "modules/csg/csg_shape.h"
+#endif
+
EditorNavigationMeshGenerator *EditorNavigationMeshGenerator::singleton = NULL;
void EditorNavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
@@ -134,6 +138,20 @@ void EditorNavigationMeshGenerator::_parse_geometry(Transform p_accumulated_tran
}
}
+#ifdef MODULE_CSG_ENABLED
+ if (Object::cast_to<CSGShape>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) {
+
+ CSGShape *csg_shape = Object::cast_to<CSGShape>(p_node);
+ Array meshes = csg_shape->get_meshes();
+ if (!meshes.empty()) {
+ Ref<Mesh> mesh = meshes[1];
+ if (mesh.is_valid()) {
+ _add_mesh(mesh, p_accumulated_transform * csg_shape->get_transform(), p_verticies, p_indices);
+ }
+ }
+ }
+#endif
+
if (Object::cast_to<StaticBody>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_MESH_INSTANCES) {
StaticBody *static_body = Object::cast_to<StaticBody>(p_node);