summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-13 13:49:02 +0200
committerGitHub <noreply@github.com>2019-05-13 13:49:02 +0200
commit9beb26cef3915ef6fafe4c6ed36c7a58494bfa3a (patch)
tree2429a82cb0174c3b31093a0514fff9f0bb353c6a
parentabc6dd7fa20bf3cb7bda6a555a76c1cf2ba1aff8 (diff)
parent4cf3113a1a4522338bb2fa1f33821a406259051f (diff)
Merge pull request #28809 from bojidar-bg/x-navmesh-wrong-vertex-order
Fix orientation of generated navmeshes
-rw-r--r--modules/recast/navigation_mesh_generator.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/recast/navigation_mesh_generator.cpp b/modules/recast/navigation_mesh_generator.cpp
index 80e98a13a5..79ccbbb030 100644
--- a/modules/recast/navigation_mesh_generator.cpp
+++ b/modules/recast/navigation_mesh_generator.cpp
@@ -126,9 +126,10 @@ void NavigationMeshGenerator::_convert_detail_mesh_to_native_navigation_mesh(con
for (unsigned int j = 0; j < ntris; j++) {
Vector<int> nav_indices;
nav_indices.resize(3);
+ // Polygon order in recast is opposite than godot's
nav_indices.write[0] = ((int)(bverts + tris[j * 4 + 0]));
- nav_indices.write[1] = ((int)(bverts + tris[j * 4 + 1]));
- nav_indices.write[2] = ((int)(bverts + tris[j * 4 + 2]));
+ nav_indices.write[1] = ((int)(bverts + tris[j * 4 + 2]));
+ nav_indices.write[2] = ((int)(bverts + tris[j * 4 + 1]));
p_nav_mesh->add_polygon(nav_indices);
}
}