suddenly, mesh modified by perlin noise is symmetric
hello. so i am a very beginner when it comes to coding, and i copied this script from a youtube tutorial to generate infinite terrain. actually it's two scripts. one is modifying the mesh of a prefab plane, the other is instantiating these planes according to the players position.
so i had the idea to check if the vertices wich are getting modified are greater or less than zero, so that i could instantiate another prefab with actual premade terrain, that doesn't get affected by the code.
i made an if statement "if (vertices[v].y and so on... else do nothing. after some fiddlinge it worked... but suddenly all the terrain was symmetrical on the z axis from the players starting position..
i removed the code, but it remained that way, even when i loaded a backup of that project.
maybe it was that way since i copied that script and i just didn't noticed, but i am very sure that isn't the case.
someone can help me out? sorry if my english is not perfect, i am not a native speaker.
here's the code that modifies the mesh: void Start() { Mesh mesh = this.GetComponent().mesh; Vector3[] vertices = mesh.vertices;
for (int v = 0; v < vertices.Length; v++)
{
vertices[v].y = Mathf.PerlinNoise((vertices[v].x + this.transform.position.x ) / detailScale,
(vertices[v].z + this.transform.position.z ) / detailScale) * heightScale;
Answer by Rob4 · Oct 15, 2018 at 08:57 PM
nevermind, i guess i figured it out. apparently i just didn't notice it before...