summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBojidar Marinov <bojidar.marinov.bg@gmail.com>2019-05-10 18:33:25 +0300
committerBojidar Marinov <bojidar.marinov.bg@gmail.com>2019-05-11 21:39:52 +0300
commit4cf3113a1a4522338bb2fa1f33821a406259051f (patch)
treefb35f03d5faf6ea3918d9585d5614cd38d9a6ce5 /modules
parentecceabea7e74b56080c8deacc4323ac18b4b47c9 (diff)
Fix orientation of generated navmeshes
Fixes #23817
Diffstat (limited to 'modules')
-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);
}
}