From a52f0941b7a6f867096d2db98f593e8bdd982abf Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 15 Jan 2024 19:47:33 -0600 Subject: [PATCH] load mesh data and structure meshes --- src/engine/CollisionEngine/CollisionManager.java | 2 +- src/engine/gameManager/BuildingManager.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/CollisionEngine/CollisionManager.java b/src/engine/CollisionEngine/CollisionManager.java index b86ee1aa..22701825 100644 --- a/src/engine/CollisionEngine/CollisionManager.java +++ b/src/engine/CollisionEngine/CollisionManager.java @@ -10,7 +10,7 @@ import java.awt.geom.Rectangle2D; public class CollisionManager { public static boolean CollisionDetected(Building building, Line2D travelLine, float charHeight, float charY){ - if(!travelLine.intersects(building.buildingRect) && !building.buildingRect.contains(travelLine.getP1()) && !building.buildingRect.contains(travelLine.getP2())) + if(building.buildingRect != null && !travelLine.intersects(building.buildingRect) && !building.buildingRect.contains(travelLine.getP1()) && !building.buildingRect.contains(travelLine.getP2())) return false; for (Mesh mesh : building.buildingMeshes) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 0e176ed0..4f0bdbf6 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -1045,7 +1045,7 @@ public enum BuildingManager { } building.buildingMeshes.add(generatedMesh); - } + } Rectangle2D.Float buildingBound = new Rectangle2D.Float(); float xLoc = building.loc.x - building.getBounds().getHalfExtents().x; float zLoc = building.loc.z - building.getBounds().getHalfExtents().y;