Browse Source

load mesh data and structure meshes

server-collision
FatBoy-DOTC 12 months ago
parent
commit
a52f0941b7
  1. 2
      src/engine/CollisionEngine/CollisionManager.java
  2. 2
      src/engine/gameManager/BuildingManager.java

2
src/engine/CollisionEngine/CollisionManager.java

@ -10,7 +10,7 @@ import java.awt.geom.Rectangle2D;
public class CollisionManager { public class CollisionManager {
public static boolean CollisionDetected(Building building, Line2D travelLine, float charHeight, float charY){ 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; return false;
for (Mesh mesh : building.buildingMeshes) for (Mesh mesh : building.buildingMeshes)

2
src/engine/gameManager/BuildingManager.java

@ -1045,7 +1045,7 @@ public enum BuildingManager {
} }
building.buildingMeshes.add(generatedMesh); building.buildingMeshes.add(generatedMesh);
} }
Rectangle2D.Float buildingBound = new Rectangle2D.Float(); Rectangle2D.Float buildingBound = new Rectangle2D.Float();
float xLoc = building.loc.x - building.getBounds().getHalfExtents().x; float xLoc = building.loc.x - building.getBounds().getHalfExtents().x;
float zLoc = building.loc.z - building.getBounds().getHalfExtents().y; float zLoc = building.loc.z - building.getBounds().getHalfExtents().y;

Loading…
Cancel
Save