SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, float scale) {
  2.         float[,] noiseMap = new float[mapWidth,mapHeight];
  3.  
  4.         if (scale <= 0) {
  5.             scale = 0.0001f;
  6.         }
  7.  
  8.         for (int y = 0; y < mapHeight; y++) {
  9.             for (int x = 0; x < mapWidth; x++) {
  10.                 float sampleX = x / scale;
  11.                 float sampleY = y / scale;
  12.  
  13.                 float perlinValue = Mathf.PerlinNoise (sampleX, sampleY);
  14.                 noiseMap [x, y] = perlinValue;
  15.             }
  16.         }
  17.  
  18.         return noiseMap;
  19.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top