Insert polygon pads in navmesh

This commit is contained in:
Mikolaj Wielgus 2026-03-11 19:17:44 +01:00
parent f3112dd886
commit 13b97f84d6
1 changed files with 9 additions and 1 deletions

View File

@ -101,6 +101,10 @@ impl NavmesherBoard {
Self::insert_joint_in_navmesher(&mut navmesher, *joint);
}
for (_, polygon) in board.layout().polygons().collection() {
Self::insert_polygon_in_navmesher(&mut navmesher, polygon.clone());
}
Self { navmesher, board }
}
@ -159,7 +163,11 @@ impl NavmesherBoard {
}
pub fn insert_polygon(&mut self, polygon: Polygon) -> PolygonId {
// TODO: Insert into navmesh.
Self::insert_polygon_in_navmesher(&mut self.navmesher, polygon.clone());
self.board.add_polygon(polygon)
}
fn insert_polygon_in_navmesher(navmesher: &mut Navmesher, polygon: Polygon) {
navmesher.insert_polygon(polygon.layer, polygon.vertices);
}
}