diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e98b27c..bbabf19a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ ### Migration Guide +## `bevy_landmass` [0.11.1] - 2026-02-21 + +### Fixes + +- `bevy_mesh_to_landmass_nav_mesh` now correctly orients faces. + ## `bevy_landmass` [0.11.0] / `landmass_rerecast` [0.2.0] - 2026-01-29 ### Migration Guide diff --git a/crates/bevy_landmass/Cargo.toml b/crates/bevy_landmass/Cargo.toml index 4f79b57e..6cfdc0ef 100644 --- a/crates/bevy_landmass/Cargo.toml +++ b/crates/bevy_landmass/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_landmass" -version = "0.11.0" +version = "0.11.1" edition = "2024" description = "A plugin for Bevy to handle navigation of AI characters." diff --git a/crates/bevy_landmass/assets/playground.glb b/crates/bevy_landmass/assets/playground.glb index fa831d81..52658190 100644 Binary files a/crates/bevy_landmass/assets/playground.glb and b/crates/bevy_landmass/assets/playground.glb differ diff --git a/crates/bevy_landmass/src/nav_mesh.rs b/crates/bevy_landmass/src/nav_mesh.rs index 17bc346d..3361e964 100644 --- a/crates/bevy_landmass/src/nav_mesh.rs +++ b/crates/bevy_landmass/src/nav_mesh.rs @@ -45,10 +45,12 @@ pub fn bevy_mesh_to_landmass_nav_mesh( assert!(indices.len() % 3 == 0); let mut polygons = Vec::with_capacity(indices.len() / 3); for i in (0..indices.len()).step_by(3) { + let (b, c) = + if CS::FLIP_POLYGONS { (i + 2, i + 1) } else { (i + 1, i + 2) }; polygons.push(vec![ indices[i] as usize, - indices[i + 1] as usize, - indices[i + 2] as usize, + indices[b] as usize, + indices[c] as usize, ]); } polygons @@ -57,10 +59,12 @@ pub fn bevy_mesh_to_landmass_nav_mesh( assert!(indices.len() % 3 == 0); let mut polygons = Vec::with_capacity(indices.len() / 3); for i in (0..indices.len()).step_by(3) { + let (b, c) = + if CS::FLIP_POLYGONS { (i + 2, i + 1) } else { (i + 1, i + 2) }; polygons.push(vec![ indices[i] as usize, - indices[i + 1] as usize, - indices[i + 2] as usize, + indices[b] as usize, + indices[c] as usize, ]); } polygons diff --git a/crates/bevy_landmass/src/nav_mesh_test.rs b/crates/bevy_landmass/src/nav_mesh_test.rs index 77b94908..2c0e4b34 100644 --- a/crates/bevy_landmass/src/nav_mesh_test.rs +++ b/crates/bevy_landmass/src/nav_mesh_test.rs @@ -105,15 +105,17 @@ fn converts_u32_indices() { ] ); + // ThreeD sets `FLIP_POLYGONS`, so the polygons end up flipped here (and then + // flipped back during validation). assert_eq!( nav_mesh.polygons, vec![ - vec![0, 1, 2], - vec![2, 3, 0], - vec![3, 2, 4], - vec![3, 4, 5], - vec![4, 2, 6], - vec![4, 6, 7], + vec![0, 2, 1], + vec![2, 0, 3], + vec![3, 4, 2], + vec![3, 5, 4], + vec![4, 6, 2], + vec![4, 7, 6], ] ); }