offset cleanup

This commit is contained in:
2024-01-05 19:06:56 -06:00
parent c92316f03e
commit 7c28efb47c
2 changed files with 17 additions and 18 deletions
@@ -49,29 +49,29 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getEndLat(),msg.getEndAlt(),msg.getEndLon());
travelLine.setLine(pc.loc.x,pc.loc.z,endLoc.x,endLoc.z);
float movementDistance = 185 + pc.loc.distance(endLoc);
boolean collided = false;
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(pc.loc, movementDistance, MBServerStatics.MASK_BUILDING);
for(AbstractWorldObject awo : awoList){
Building building = (Building)awo;
Rectangle.Float boundsRect = new Rectangle.Float();
boundsRect.setRect(building.loc.x + building.getBounds().getHalfExtents().x, building.loc.z + building.getBounds().getHalfExtents().y, building.getBounds().getHalfExtents().x * 2,building.getBounds().getHalfExtents().y * 2);
//if(travelLine.intersects(boundsRect)){
float rectCenterX = building.loc.x + building.getBounds().getHalfExtents().x;
float rectCenterZ = building.loc.z + building.getBounds().getHalfExtents().y;
boundsRect.setRect(rectCenterX, rectCenterZ, building.getBounds().getHalfExtents().x * 2,building.getBounds().getHalfExtents().y * 2);
if(travelLine.intersects(boundsRect)){
//collided with building
for(Mesh mesh : building.buildingMeshes) {
float height = pc.getCharacterHeight();
if (height < mesh.meshHeight) {
for (Triangle tri : mesh.triangles) {
if (tri.collides(travelLine)) {
if (mesh.MeshCollides(travelLine,pc.getCharacterHeight()))
for (Triangle tri : mesh.triangles)
if (tri.collides(travelLine)){
ChatManager.chatSystemInfo(pc, "Collision Detected");
MovementManager.movement(msg, pc);
return true;
}
}
}
}
//}
}
}
ChatManager.chatSystemInfo(pc, "No Collision Detected");
ChatManager.chatSystemInfo(pc, "No Collision Detected");
MovementManager.movement(msg, pc);
return true;
}