- Home /
Question by
NoCandyIncluded · May 31, 2019 at 03:54 PM ·
terrainminecraftperlin noiseblocks
Add perlin noise to blocky terrain
So im making a Terrain made out of blocks and I want to offset the blocks on the y-axis using perlin-noise but everything I tried didnt work. So far all this code does is create a flat plane made of blocks.
Also, please don't link to someone elses code, I want to do as much of this on my own as possible for practice, thanks!
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class terrain : MonoBehaviour
{
public GameObject Grass;
private GameObject copy;
public int Width;
public int Length;
private Vector3 trans;
// Start is called before the first frame update
void Start()
{
trans = transform.position;
for (int width = 0; width < Width; width++)
{
trans.x += 1;
trans.z = 0;
Quaternion rotation = Quaternion.Euler(0, 0, 0);
copy = Instantiate(Grass, trans, rotation);
copy.SetActive(true);
for (int length = 0; length < Length; length++)
{
trans.z += 1;
copy = Instantiate(Grass, trans, rotation);
copy.SetActive(true);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
15625 blocks are making my game lag? Increase performance? 3 Answers
Random Terrain Generation (Trees, Details, Textures) by passing a Seed? 0 Answers
World Generation with Interesting Terrain 0 Answers
How exactly is Perlin Noise implemented? 4 Answers
Perlin noise for (sort of Minecraft) terrain generator 2 Answers