From 77c32f9081a982200210672c100843d7b1210285 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 28 Oct 2023 00:09:15 -0500 Subject: [PATCH] region work --- src/engine/objects/Building.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index d65ccb22..d8ac936b 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -1536,6 +1536,14 @@ 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))); + + //add in all the regions to the navMesh for(Regions region : this.getBounds().getRegions()) this.parentZone.navMesh.add(region.getArea()); }