Method cleanup
This commit is contained in:
@@ -966,24 +966,29 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
public static void bakeNavMesh(Building building) {
|
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
|
// Build up navmesh by stencil of the
|
||||||
// prop's convex hull
|
// convex hull meshes that comprise the prop.
|
||||||
|
|
||||||
ArrayList<ArrayList<Vector2f>> convexHullList;
|
ArrayList<ArrayList<Vector2f>> convexHullList;
|
||||||
convexHullList = _hull_data.get(building.meshUUID);
|
convexHullList = _hull_data.get(building.meshUUID);
|
||||||
|
|
||||||
for (ArrayList<Vector2f> meshEntry : convexHullList) {
|
for (ArrayList<Vector2f> meshEntry : convexHullList) {
|
||||||
|
|
||||||
Path2D.Float stencil = new Path2D.Float();
|
Path2D.Float stencilPath = new Path2D.Float();
|
||||||
|
|
||||||
for (Vector2f vertex : meshEntry)
|
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);
|
building.parentZone.navMesh.subtract(stencilArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user