Moved steepness calculation

This commit is contained in:
2015-05-21 11:49:04 +03:00
parent 7bd2b7b255
commit e51c74944d
2 changed files with 27 additions and 15 deletions

View File

@ -123,12 +123,7 @@ public class TerrainGeneratorScript : MonoBehaviour
float height = map.GetHeight(ix, iy);
// Get steepness
int safex = (ix == 0) ? 1 : ix;
int safey = (iy == 0) ? 1 : iy;
float dx = map.GetHeight(safex - 1, safey) - height;
float dy = map.GetHeight(safex, safey - 1) - height;
float steepness = dx * dx + dy * dy;
float steepness = map.GetSteepness(ix, iy);
// Go through each texture layer
float[] weights = new float[terrainData.alphamapLayers];