Skip to content

Commit

Permalink
fixed boundaries of painted area
Browse files Browse the repository at this point in the history
solved the issue with one line and one row having no color
  • Loading branch information
vyshnovka committed Feb 16, 2024
1 parent b608781 commit 3681d68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/Scripts/Managers/TerrainGenerationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ private void PaintTerrain()

// Loop through each point on terrain and set color depending on height and selected gradient.
var selectedGradient = gradients[SelectedGradientTypeAsNumber];
for (int x = 0; x < terrain.terrainData.heightmapResolution; x++)
for (int x = 0; x < terrain.terrainData.heightmapResolution - 1; x++)
{
for (int y = 0; y < terrain.terrainData.heightmapResolution; y++)
for (int y = 0; y < terrain.terrainData.heightmapResolution - 1; y++)
{
float height = heights[x, y];
Color color = selectedGradient.Evaluate(height);
Expand Down

0 comments on commit 3681d68

Please sign in to comment.