Clamp fix for new method

This commit is contained in:
2023-11-18 12:57:53 -05:00
parent 898e37eedb
commit 15313b3460
+4 -4
View File
@@ -56,8 +56,8 @@ public class Terrain {
this.terrain_size.x = this.zone.major_radius * 2; this.terrain_size.x = this.zone.major_radius * 2;
this.terrain_size.y = this.zone.minor_radius * 2; this.terrain_size.y = this.zone.minor_radius * 2;
this.cell_count.x = this.image_size.x; this.cell_count.x = this.image_size.x - 1;
this.cell_count.y = this.image_size.y; this.cell_count.y = this.image_size.y - 1;
this.cell_size.x = terrain_size.x / this.cell_count.x; this.cell_size.x = terrain_size.x / this.cell_count.x;
this.cell_size.y = terrain_size.y / this.cell_count.y; this.cell_size.y = terrain_size.y / this.cell_count.y;
@@ -164,8 +164,8 @@ public class Terrain {
// Clamp values when standing directly on pole // Clamp values when standing directly on pole
terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 2, terrain_cell.x)); terrain_cell.x = Math.max(0, Math.min(this.cell_count.x - 1, terrain_cell.x));
terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 2, terrain_cell.y)); terrain_cell.y = Math.max(0, Math.min(this.cell_count.y - 1, terrain_cell.y));
return terrain_cell; return terrain_cell;
} }