diff options
-rw-r--r-- | modules/navigation/navigation_mesh_generator.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp index 05e040b518..7e731e6753 100644 --- a/modules/navigation/navigation_mesh_generator.cpp +++ b/modules/navigation/navigation_mesh_generator.cpp @@ -36,6 +36,7 @@ #include "core/os/thread.h" #include "scene/3d/collision_shape_3d.h" #include "scene/3d/mesh_instance_3d.h" +#include "scene/3d/multimesh_instance_3d.h" #include "scene/3d/physics_body_3d.h" #include "scene/resources/box_shape_3d.h" #include "scene/resources/capsule_shape_3d.h" @@ -148,6 +149,21 @@ void NavigationMeshGenerator::_parse_geometry(Transform3D p_accumulated_transfor } } + if (Object::cast_to<MultiMeshInstance3D>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { + MultiMeshInstance3D *multimesh_instance = Object::cast_to<MultiMeshInstance3D>(p_node); + Ref<MultiMesh> multimesh = multimesh_instance->get_multimesh(); + Ref<Mesh> mesh = multimesh->get_mesh(); + if (mesh.is_valid()) { + int n = multimesh->get_visible_instance_count(); + if (n == -1) { + n = multimesh->get_instance_count(); + } + for (int i = 0; i < n; i++) { + _add_mesh(mesh, p_accumulated_transform * multimesh->get_instance_transform(i), p_verticies, p_indices); + } + } + } + #ifdef MODULE_CSG_ENABLED if (Object::cast_to<CSGShape3D>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { CSGShape3D *csg_shape = Object::cast_to<CSGShape3D>(p_node); |