From 70e47996b8fe88ddcd27aa8b796c18af8c2c7e13 Mon Sep 17 00:00:00 2001 From: Saracen Date: Mon, 9 Oct 2017 13:14:27 +0100 Subject: [PATCH] Fix bug in navmesh generation when using meshes with multiple surfaces. --- editor/plugins/navigation_mesh_generator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/plugins/navigation_mesh_generator.cpp b/editor/plugins/navigation_mesh_generator.cpp index 526db3a5820..86dc5c36635 100644 --- a/editor/plugins/navigation_mesh_generator.cpp +++ b/editor/plugins/navigation_mesh_generator.cpp @@ -38,9 +38,11 @@ void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector & } void NavigationMeshGenerator::_add_mesh(const Ref &p_mesh, const Transform &p_xform, Vector &p_verticies, Vector &p_indices) { - int current_vertex_count = p_verticies.size() / 3; + int current_vertex_count = 0; for (int i = 0; i < p_mesh->get_surface_count(); i++) { + current_vertex_count = p_verticies.size() / 3; + if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) continue;