I’m not seeing an error in the JavaScript console when I open that code. It looks like this is the code after fixing it from the previous post – after moving the for-loop.
It looks like the i
and j
loops starting on line 55 are a bit mixed up:
for(var i=0; i<numVertices; i++) {
var curve = 20 * Math.sin(7*Math.PI * j/numVertices);
var riverCenter = j + Math.floor(curve);
shape.vertices[riverCenter].z = -1;
}
for(var j=50; j<numVertices; j+=100) {
shape.vertices[j].z = -1;
}
Instead of the above, replace them with:
for (var i=0; i<numVertices; i++) {
var vertex = shape.vertices[i];
var noise = 0.25 * noiseMaker.noise(vertex.x, vertex.y);
vertex.z = noise;
}
for (var j=50; j<numVertices; j+=100) {
var curve = 20 * Math.sin(7*Math.PI * j/numVertices);
var riverCenter = j + Math.floor(curve);
shape.vertices[riverCenter].z = -1;
}
-Chris