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;