Browse Source

Use half extents as offset from center

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
279a0aed91
  1. 4
      src/engine/InterestManagement/Terrain.java
  2. 4
      src/engine/devcmd/cmds/GetHeightCmd.java

4
src/engine/InterestManagement/Terrain.java

@ -184,8 +184,8 @@ public class Terrain {
// Normalize terrain offset // Normalize terrain offset
Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.terrain_size.x, Vector2f normalizedOffset = new Vector2f(Math.abs(zone_offset.x) / this.zone.major_radius,
Math.abs(zone_offset.y) / terrain_size.y); Math.abs(zone_offset.y) / this.zone.minor_radius);
float xval; float xval;

4
src/engine/devcmd/cmds/GetHeightCmd.java

@ -40,8 +40,8 @@ public class GetHeightCmd extends AbstractDevCmd {
Vector2f zoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone); Vector2f zoneLoc = ZoneManager.worldToTerrainSpace(playerCharacter.getLoc(), heightmapZone);
Vector2f zoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone); Vector2f zoneOffset = ZoneManager.worldToZoneOffset(playerCharacter.getLoc(), heightmapZone);
Vector2f normalizedOffset = new Vector2f(Math.abs(zoneOffset.x) / heightmapZone.terrain.terrain_size.x, Vector2f normalizedOffset = new Vector2f(Math.abs(zoneOffset.x) / heightmapZone.major_radius,
Math.abs(zoneOffset.y) / heightmapZone.terrain.terrain_size.y); Math.abs(zoneOffset.y) / heightmapZone.minor_radius);
Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(zoneLoc); Vector2f gridSquare = heightmapZone.terrain.getTerrainCell(zoneLoc);
gridSquare.x = (float) Math.floor(gridSquare.x); gridSquare.x = (float) Math.floor(gridSquare.x);

Loading…
Cancel
Save