Comments and formatting
This commit is contained in:
@@ -1009,6 +1009,8 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
public static Path2D.Float hullToPath2d(String[] hullString) {
|
public static Path2D.Float hullToPath2d(String[] hullString) {
|
||||||
|
|
||||||
|
// Method builds convex hull from database vertices
|
||||||
|
|
||||||
ArrayList<Vector2f> vertices = new ArrayList<>();
|
ArrayList<Vector2f> vertices = new ArrayList<>();
|
||||||
ArrayList<Float> floats = new ArrayList<>();
|
ArrayList<Float> floats = new ArrayList<>();
|
||||||
Path2D.Float outPath = new Path2D.Float();
|
Path2D.Float outPath = new Path2D.Float();
|
||||||
@@ -1041,14 +1043,22 @@ public enum BuildingManager {
|
|||||||
return outPath;
|
return outPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadColliders(Building building){
|
public static void loadColliders(Building building) {
|
||||||
|
|
||||||
|
// Load colliders for this building
|
||||||
|
|
||||||
building.meshes = new ArrayList<>();
|
building.meshes = new ArrayList<>();
|
||||||
for(Path2D.Float path : _hull_data.get(building.meshUUID)){
|
|
||||||
|
for (Path2D.Float path : _hull_data.get(building.meshUUID)) {
|
||||||
|
|
||||||
Path2D.Float translatedPath = new Path2D.Float(path);
|
Path2D.Float translatedPath = new Path2D.Float(path);
|
||||||
AffineTransform offset = AffineTransform.getTranslateInstance(building.loc.x , building.loc.y);
|
AffineTransform offset = AffineTransform.getTranslateInstance(building.loc.x, building.loc.y);
|
||||||
|
|
||||||
translatedPath.transform(offset);
|
translatedPath.transform(offset);
|
||||||
|
|
||||||
AffineTransform rotate = AffineTransform.getRotateInstance(Math.toRadians(building.getBounds().getQuaternion().angleY), building.loc.x, building.loc.z);
|
AffineTransform rotate = AffineTransform.getRotateInstance(Math.toRadians(building.getBounds().getQuaternion().angleY), building.loc.x, building.loc.z);
|
||||||
translatedPath.transform(rotate);
|
translatedPath.transform(rotate);
|
||||||
|
|
||||||
building.meshes.add(translatedPath);
|
building.meshes.add(translatedPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user