瀏覽代碼

Merge pull request #11965 from SaracenOne/navgen_fix

Navmesh Generation Fix

[ci skip]
Rémi Verschelde 8 年之前
父節點
當前提交
bf12b45986
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      editor/plugins/navigation_mesh_generator.cpp

+ 3 - 1
editor/plugins/navigation_mesh_generator.cpp

@@ -38,9 +38,11 @@ void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &
 }
 
 void NavigationMeshGenerator::_add_mesh(const Ref<Mesh> &p_mesh, const Transform &p_xform, Vector<float> &p_verticies, Vector<int> &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;