Browse Source

Update to bake logic

hull4
MagicBot 1 year ago
parent
commit
6aff5307c7
  1. 16
      src/engine/gameManager/BuildingManager.java

16
src/engine/gameManager/BuildingManager.java

@ -986,13 +986,24 @@ public enum BuildingManager { @@ -986,13 +986,24 @@ public enum BuildingManager {
Path2D.Float stencilPath = new Path2D.Float();
// Add building offset to vertices
for (Vector2f vertex : meshEntry)
stencilPath.moveTo(vertex.x, vertex.y);
vertex.addLocal(building.getLoc().x, building.getLoc().y);
// enclose the path
// Move to start of path
stencilPath.moveTo(meshEntry.get(0).x, meshEntry.get(0).y);
// Draw path
for (int i = 1; i < meshEntry.size(); i++)
stencilPath.lineTo(meshEntry.get(i).x, meshEntry.get(i).y);
// enclose the path
stencilPath.closePath();
// subtract stencil from zone navmesh
Area stencilArea = new Area(stencilPath);
@ -1000,6 +1011,7 @@ public enum BuildingManager { @@ -1000,6 +1011,7 @@ public enum BuildingManager {
}
//add in all the regions to the navMesh
for (Regions region : building.getBounds().getRegions())
building.parentZone.navMesh.add(region.getArea());
}

Loading…
Cancel
Save