|
|
|
@ -277,24 +277,24 @@ public enum ZoneManager {
@@ -277,24 +277,24 @@ public enum ZoneManager {
|
|
|
|
|
// Converts world coordinates to coordinates local to a given zone.
|
|
|
|
|
|
|
|
|
|
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector, |
|
|
|
|
Zone serverZone) { |
|
|
|
|
Zone zone) { |
|
|
|
|
|
|
|
|
|
Vector3fImmutable localCoords; |
|
|
|
|
|
|
|
|
|
localCoords = new Vector3fImmutable(worldVector.x - serverZone.absX, |
|
|
|
|
worldVector.y - serverZone.absY, worldVector.z |
|
|
|
|
- serverZone.absZ); |
|
|
|
|
localCoords = new Vector3fImmutable(worldVector.x - zone.absX, |
|
|
|
|
worldVector.y - zone.absY, worldVector.z |
|
|
|
|
- zone.absZ); |
|
|
|
|
|
|
|
|
|
return localCoords; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Vector2f worldToZoneOffset(Vector3fImmutable worldLoc, |
|
|
|
|
Zone serverZone) { |
|
|
|
|
Zone zone) { |
|
|
|
|
|
|
|
|
|
Vector2f localCoords; |
|
|
|
|
Vector2f zoneOrigin; |
|
|
|
|
|
|
|
|
|
zoneOrigin = new Vector2f(serverZone.getLoc().x, serverZone.getLoc().z); |
|
|
|
|
zoneOrigin = new Vector2f(zone.getLoc().x, zone.getLoc().z); |
|
|
|
|
localCoords = new Vector2f(worldLoc.x, worldLoc.z); |
|
|
|
|
localCoords = localCoords.subtract(zoneOrigin); |
|
|
|
|
|
|
|
|
@ -303,15 +303,15 @@ public enum ZoneManager {
@@ -303,15 +303,15 @@ public enum ZoneManager {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Vector2f worldToTerrainSpace(Vector3fImmutable worldLoc, |
|
|
|
|
Zone serverZone) { |
|
|
|
|
Zone zone) { |
|
|
|
|
|
|
|
|
|
Vector2f localCoords; |
|
|
|
|
Vector2f zoneOrigin; |
|
|
|
|
|
|
|
|
|
// Top left corner of zone is calculated in world space by the center and it's extents.
|
|
|
|
|
|
|
|
|
|
zoneOrigin = new Vector2f(serverZone.getLoc().x, serverZone.getLoc().z); |
|
|
|
|
zoneOrigin = zoneOrigin.subtract(new Vector2f(serverZone.bounds.getHalfExtents().x, serverZone.bounds.getHalfExtents().y)); |
|
|
|
|
zoneOrigin = new Vector2f(zone.getLoc().x, zone.getLoc().z); |
|
|
|
|
zoneOrigin = zoneOrigin.subtract(new Vector2f(zone.bounds.getHalfExtents().x, zone.bounds.getHalfExtents().y)); |
|
|
|
|
|
|
|
|
|
// Local coordinate in world space translated to an offset from the calculated zone origin.
|
|
|
|
|
|
|
|
|
|