Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, float scale) {
- float[,] noiseMap = new float[mapWidth,mapHeight];
- if (scale <= 0) {
- scale = 0.0001f;
- }
- for (int y = 0; y < mapHeight; y++) {
- for (int x = 0; x < mapWidth; x++) {
- float sampleX = x / scale;
- float sampleY = y / scale;
- float perlinValue = Mathf.PerlinNoise (sampleX, sampleY);
- noiseMap [x, y] = perlinValue;
- }
- }
- return noiseMap;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement