Browse Source

Comments and formatting

hull7
MagicBot 1 year ago
parent
commit
221ef76ece
  1. 10
      src/engine/gameManager/BuildingManager.java

10
src/engine/gameManager/BuildingManager.java

@ -1009,6 +1009,8 @@ public enum BuildingManager { @@ -1009,6 +1009,8 @@ public enum BuildingManager {
public static Path2D.Float hullToPath2d(String[] hullString) {
// Method builds convex hull from database vertices
ArrayList<Vector2f> vertices = new ArrayList<>();
ArrayList<Float> floats = new ArrayList<>();
Path2D.Float outPath = new Path2D.Float();
@ -1042,13 +1044,21 @@ public enum BuildingManager { @@ -1042,13 +1044,21 @@ public enum BuildingManager {
}
public static void loadColliders(Building building) {
// Load colliders for this building
building.meshes = new ArrayList<>();
for (Path2D.Float path : _hull_data.get(building.meshUUID)) {
Path2D.Float translatedPath = new Path2D.Float(path);
AffineTransform offset = AffineTransform.getTranslateInstance(building.loc.x, building.loc.y);
translatedPath.transform(offset);
AffineTransform rotate = AffineTransform.getRotateInstance(Math.toRadians(building.getBounds().getQuaternion().angleY), building.loc.x, building.loc.z);
translatedPath.transform(rotate);
building.meshes.add(translatedPath);
}
}

Loading…
Cancel
Save