collision work

This commit is contained in:
2024-01-05 20:13:27 -06:00
parent e3641872d0
commit c65a713bae
2 changed files with 22 additions and 10 deletions
@@ -15,6 +15,7 @@ import engine.Enum.ProtectionState;
import engine.Enum.TaxType;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.math.Vector2f;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.objects.*;
@@ -932,8 +933,13 @@ public class dbBuildingHandler extends dbHandlerBase {
float endZ = Float.parseFloat(rs.getString("end").split(";")[1]);
float refX = Float.parseFloat(rs.getString("ref").split(";")[0]);
float refZ = Float.parseFloat(rs.getString("ref").split(";")[1]);
Vector2f topLeft = new Vector2f(centerX - refX,centerZ - refZ);
float width = Math.abs(endX-refX);
float height = Math.abs(endZ-refZ);
Rectangle2D boundRect = new Rectangle2D.Float();
boundRect.setRect(centerX,centerZ,Math.abs(endX-refX),Math.abs(endZ-refZ));
boundRect.setRect(topLeft.x,topLeft.y,width,height);
BuildingManager.mesh_bounding_boxes.put(rs.getInt("meshId"),boundRect);
}
}