hull 7
This commit is contained in:
@@ -29,6 +29,7 @@ import engine.objects.*;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Path2D;
|
import java.awt.geom.Path2D;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@@ -965,7 +966,7 @@ public enum BuildingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void bakeNavMesh(Building building) {
|
public static void bakeNavMesh(Building building) {
|
||||||
building.meshes = new ArrayList<>();
|
|
||||||
if (building.parentZone == null) {
|
if (building.parentZone == null) {
|
||||||
Logger.error("Attempt to bake navmesh with no parent: " + building.getObjectUUID());
|
Logger.error("Attempt to bake navmesh with no parent: " + building.getObjectUUID());
|
||||||
return;
|
return;
|
||||||
@@ -982,10 +983,6 @@ public enum BuildingManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Path2D.Float meshEntry : convexHullList) {
|
|
||||||
building.meshes.add(meshEntry);
|
|
||||||
building.parentZone.navObstacles.add(meshEntry);
|
|
||||||
}
|
|
||||||
//add navNodes to parent zone list
|
//add navNodes to parent zone list
|
||||||
float X = building.getBounds().getHalfExtents().x;
|
float X = building.getBounds().getHalfExtents().x;
|
||||||
float Y = building.getBounds().getHalfExtents().y;
|
float Y = building.getBounds().getHalfExtents().y;
|
||||||
@@ -1043,4 +1040,16 @@ public enum BuildingManager {
|
|||||||
outPath.closePath();
|
outPath.closePath();
|
||||||
return outPath;
|
return outPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadColliders(Building 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.getRot().y), building.loc.x, building.loc.z);
|
||||||
|
translatedPath.transform(rotate);
|
||||||
|
building.meshes.add(translatedPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1008,6 +1008,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
if (this.upgradeDateTime != null)
|
if (this.upgradeDateTime != null)
|
||||||
BuildingManager.submitUpgradeJob(this);
|
BuildingManager.submitUpgradeJob(this);
|
||||||
|
|
||||||
|
BuildingManager.loadColliders(this); // load building colliders
|
||||||
BuildingManager.bakeNavMesh(this); // update the navmesh of the parent zone
|
BuildingManager.bakeNavMesh(this); // update the navmesh of the parent zone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user