I want to make a perlin noise in Unity3D in the terrain, I don’t know exactly what it means but I guess it makes the terrain mathematical fun!
So here is the code of my terrain generator:
`using UnityEngine;
using System.Collections;
public class GenerateWorld : MonoBehaviour {
public int x;
public int y;
public int z;
public Transform prefab;
void Start () {
for(int a = 0; a < x; a++)
{
for(int b = 0; b < y; b++)
{
for (int c = 0; c < z; c++)
{
Instantiate(prefab, new Vector3(a, b, c), Quaternion.identity);
}
}
}
}
void Update() {
if(x < 0) {
x = 0;
}
if(y < 0) {
y = 0;
}
if(z < 0) {
z = 0;
}
}
void OnGUI() {
GUI.Box(new Rect(Screen.width/2 - 350, 10, 700, 25), "The values you typed in are: " + x.ToString() + " " + y.ToString() + " " + z.ToString() + ". All values must be above zero, please!");
}
}
So anyone who can help me to put the perlin noise code inside my code, so I would have the future to add perlin noise to my terrain.
And sorry for my English I am from the Netherlands.
Thanks in advance. (PS: If you don’t understand me, ask me any questions)