Quantcast
Channel: Questions in topic: "namespace"
Viewing all articles
Browse latest Browse all 398

NoiseMapGeneration namespace not found

$
0
0
I am trying to make procedural world generation and whenever I typed in this script, the namespace of `NoiseMapGeneration`. I dont know what I did but here is my code Can anyone help me? It says the namespace `NoiseMapGeneration` isnt found using System.Collections; using System.Collections.Generic; using UnityEngine; public class TileGeneration : MonoBehaviour { [SerializeField] NoiseMapGeneration noiseMapGeneration; [SerializeField] public MeshRenderer tileRenderer; [SerializeField] public MeshFilter meshFilter; [SerializeField] public MeshCollider meshCollider; [SerializeField] public float mapScale; void Start() { GenerateTile(); } void GenerateTile() { // calculate tile depth and width based on the mesh vertices Vector3[] meshVertices = this.meshFilter.mesh.vertices; int tileDepth = (int)Mathf.Sqrt(meshVertices.Length); int tileWidth = tileDepth; // calculate the offsets based on the tile position float[,] heightMap = this.noiseMapGeneration.GenerateNoiseMap(tileDepth, tileWidth, this.mapScale); // generate a heightMap using noise Texture2D tileTexture = BuildTexture(heightMap); this.tileRenderer.material.mainTexture = tileTexture; } private Texture2D BuildTexture(float[,] heightMap) { int tileDepth = noiseMap.GetLength(0); int tileWidth = noiseMap.GetLength(1); Color[] colorMap = new Color[tileDepth * tileWidth]; for (int zIndex = 0; zIndex < tileDepth; zIndex++) { for (int xIndex = 0; xIndex < tileWidth; xIndex++) { // transform the 2D map index is an Array index int colorIndex = zIndex * tileWidth + xIndex; float height = heightMap[zIndex, xIndex]; // assign as color a shade of grey proportional to the height value colorMap[colorIndex] = Color.Lerp(Color.black, Color.white, height); } } // create a new texture and set its pixel colors Texture2D tileTexture = new Texture2D(tileWidth, tileDepth); tileTexture.wrapMode = TextureWrapMode.Clamp; tileTexture.SetPixels(colorMap); tileTexture.Apply(); return tileTexture; } }

Viewing all articles
Browse latest Browse all 398

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>