Method cleanup

This commit is contained in:
2023-11-06 11:42:06 -05:00
parent 19d43cbcb0
commit 2166a0a440
+11 -6
View File
@@ -966,24 +966,29 @@ public enum BuildingManager {
public static void bakeNavMesh(Building building) {
if (building.parentZone == null)
Logger.error("Attempt to bake navmesh with no parent: " + building.getObjectUUID());
// Build up navmesh by stencil of the
// prop's convex hull
// convex hull meshes that comprise the prop.
ArrayList<ArrayList<Vector2f>> convexHullList;
convexHullList = _hull_data.get(building.meshUUID);
for (ArrayList<Vector2f> meshEntry : convexHullList) {
Path2D.Float stencil = new Path2D.Float();
Path2D.Float stencilPath = new Path2D.Float();
for (Vector2f vertex : meshEntry)
stencil.moveTo(vertex.x, vertex.y);
stencilPath.moveTo(vertex.x, vertex.y);
// enclose polygon
// enclose the path
stencil.moveTo(meshEntry.get(0).x, meshEntry.get(0).y);
stencilPath.moveTo(meshEntry.get(0).x, meshEntry.get(0).y);
Area stencilArea = new Area(stencil);
// subtract stencil from zone navmesh
Area stencilArea = new Area(stencilPath);
building.parentZone.navMesh.subtract(stencilArea);
}