Perlin noise continuous through different objects

I want to use a Perlin noise function that acts continuously through different objects (planes in this case), wich means, with no gaps between vertices of different meshes. I’ve attached the script that applies the Perlin noise in a parent game object (an empty game object). The script runs the Perlin noise function once and search for the childrens (the planes), applying the noise to each vertex of each plane.

It worked when the noise is applyied only in one direction, but it doesn’t when two or more directions are used. [This question][1] seems to use the same idea I have here, but I’ve tried many things suggested by the answers and comments provided there and could not come to a solution (Actually, I didn’t understand some of the code provided there, I’m not a experienced programmer).

Here are some screenshots of when it works and when it doesn’t, and the code (JS). The script is a simplified version of the one found in the [Unity’s Procedural Examples][2], and the Perlin Noise function can be found there too.


![alt text][3]


var scale : float = 1.0;
var recalculateNormals = true;

private var perlin : Perlin = new Perlin();

function Start ()
for(var childPlane : Transform in transform) 

function MakePerlin(childPlane : Transform){

var baseVertices : Vector3[];

var mesh : Mesh = childPlane.GetComponent(MeshFilter).mesh;
if (baseVertices == null)
baseVertices = mesh.vertices;
var vertices = new Vector3[baseVertices.Length];
for (var i = 0; i < vertices.Length; i++)
var vertex = baseVertices*;*

var worldPosition : Vector3 = childPlane.transform.TransformPoint(baseVertices*);*

vertex.y += perlin.Noise(worldPosition.x + 0.1, worldPosition.z + 0.1) * scale;

vertices = vertex;

mesh.vertices = vertices;

if (recalculateNormals)

childPlane.GetComponent(MeshCollider).sharedMesh = null;
childPlane.GetComponent(MeshCollider).sharedMesh = mesh;
I don’t know if my logic is flawed, but it seems to be almost there. Thanks in advance.
Solved. It was very simple: it was just a matter of converting each vertex coordinate (by default, in local space) to world space. Once we know each vertex world coordinates, the Perlin noise function can be applied to world space coordinates, so every vertex that shares that world space coordinate will have the same noise. Below, an image showing it. And the code has been updated too.
Just posted it so that if anyone comes across this question, it may be useful.
[3]: /storage/temp/2601-perlin_example_1.jpg*


I don’t know if I can answer my own question but I’ve come to a solution and just wanted to mark it as solved (look at the edits in the question itself).