- Home /
Attempting terrain generation
Okay, So, I've gone through several tutorials, and I feel like I'm missing something really really simple. The method I'm trying to replicate is: Get all the vertices of a plane, put them in an array, run the array through Perlin Noise, assign all the vertices based on the value of the perlin. That's how this is supposed to work right? However, all I get are ridges going across the entire plane in one direction, instead of all the way around.
var vertex : GameObject;
var scale : float = 6.5;
//var move : boolean = false;
var m : float;
var Verts : Vector3[];
function Start () {
vertex = gameObject;
var mf : MeshFilter = vertex.GetComponent(MeshFilter);
Verts = mf.mesh.vertices;
for(var point: Vector3 in Verts){
var height = Mathf.PerlinNoise(point.x/scale, point.z/scale);
point.z = height*3;
}
mf.mesh.vertices = Verts;
mf.mesh.RecalculateBounds();
mf.mesh.RecalculateNormals();
}
What step am I missing here?
Answer by Mikael-H · Sep 05, 2014 at 10:42 AM
Is your up-direction along y-axis? If so you need to assign the height value to the vertex y-value instead of z. If z is up then you should send in the y-value as parameter to the noise function.
Should have responded earlier but: I had a feeling that it was going to be something stupid like this, and I was right! Oh the difference one letter can make.
Your answer
Follow this Question
Related Questions
Procedural Island Terrain Generation 2 Answers
Procedual Terrain 1 Answer
Add perlin noise to blocky terrain 0 Answers
perlin noise terrain is spikey 0 Answers
2d Top-Down Perlin noise map using Mathf.PerlinNoise 3 Answers