hi, I have to implement a endless road with left and right turns, for a ball racing game (it is a school project).
I've seen minecraft tutorials on youtube suggesting to use Perlin Noise to create hills in a terrain.
So I've tried to modify this solution by trying to write the Perlin Noise output of x,z to x or z axis instead of y.
For example,
Perlin Noise -minecraft terrain
float detailScale=4.0f // a constant
Vector3[] vertices = mesh.vertices;
for (int v = 0; v < vertices.Length; v++) {
//smooth & random curves gerated --based on minecraft tutorial
vertices [v].y = Mathf.PerlinNoise ((vertices [v].x + this.transform.position.x) / detailScale, (vertices [v].z + this.transform.position.z) / detailScale) ;
}
So I've replaced z with y and vetrices[v].y -> vetrices[v].z or vetrices[v].x
But It doesn't have the expected results. Any ideas?
↧