I am working on a script that creates an infinite terrain using a planes and perlin noise.
the issue i am having is in my current setup the perlin noise is seeded by the mesh’s vertices local position.
for (int i = 0; i < vertices.Length; i++) {
float xCoord = _VNoise.x + vertices<em>.x * _NoiseScale;</em>
float yCoord = VNoise.y + vertices.z * NoiseScale;
vertices.y += (Mathf.PerlinNoise (xCoord, yCoord) - 0.5f) * NoisePower;
}
mf.mesh.vertices = vertices;
mf.mesh.RecalculateBounds();
mf.mesh.RecalculateNormals();
* MeshCollider mc = (MeshCollider) this.gameObject.GetComponent(typeof(MeshCollider));
if (mc != null)
mc.sharedMesh = mf.mesh;
}*
How would i go about sampling the global position?
thanks, SirMalarkey._