From bdb901afce484d081c701e1c72dfb24dba242662 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 28 Oct 2023 12:49:27 -0500 Subject: [PATCH] region work --- src/engine/objects/Building.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index 4399e92b..d9e40496 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -1536,12 +1536,13 @@ public class Building extends AbstractWorldObject { } public void updateNavMesh(){ - //remove entire building footprint from the navmesh - //int xPoint = (int)(this.loc.x - this.getBounds().getHalfExtents().x); - //int zPoint = (int) (this.loc.z - this.getBounds().getHalfExtents().y); - //int extentsX = (int) (this.getBounds().getHalfExtents().x * 2); - //int extentsZ = (int) (this.getBounds().getHalfExtents().y * 2); - //this.parentZone.navMesh.subtract(new Area(new Rectangle(xPoint, zPoint, extentsX, extentsZ))); + Polygon area = new Polygon(); + for(Colliders collider : this.getBounds().colliders){ + area.addPoint((int) collider.startX, (int) collider.startY); + area.addPoint((int) collider.endX, (int) collider.endY); + } + Area blocked = new Area(area); + this.parentZone.navMesh.subtract(blocked); //add in all the regions to the navMesh for(Regions region : this.getBounds().getRegions())