Guest User

TerrainHeight

a guest
Jul 13th, 2024
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. public static float GetTerrainHeight (int x, int z) { //Get the height at each corner
  2.  
  3.             //Mathf.PerlinNoise gets a value between 0 and 1, so we have to multiple and add to get a value
  4.             //between 60 and 70
  5.             return (float)terrainHeightRange * Mathf.PerlinNoise((float)x / 16f * 1.5f + 0.001f, (float)z / 16f * 1.5f + 0.001f) + baseTerrainHeight;
  6.  
  7.         }
Advertisement
Add Comment
Please, Sign In to add comment