Updating the z-index on Meshbuilder.CreateGround()

Hi,

I started playing around with Babylon; attempting to produce dynamic terrain. Google isn’t short of links when we type keywords relating to this, but for some reason I’m having trouble finding how I can update the z-index value for points in the Meshbuilder.CreateGround(). Here’s my function.

export function terrainGeneration<T extends Material>(material: T, cols: number, rows: number, scene: Scene, noise: number[][]) {
  const height = 256;
  const width = 256;
  for (let i = 0; i < cols; i++) {
    for (let j = 0; j < rows; j++) {
      const ground = MeshBuilder.CreateGround("ground", { height, width, subdivisions: 10 }, scene);
      const x = j % 2 != 0 ? width : -width;
      const z = i % 2 != 0 ? height : -height;
      ground.setAbsolutePosition(new Vector3((j * x) / 2, 0, (i * z) / 2));
      ground.material = material;
      ground.material.wireframe = true;
    }
  }
}

I pre-generate the noise but am unsure where and how to apply it.
Anyone has any idea?

Also, I notice Vector3 seems to have the y and z constructor parameters inversed? Here a screenshot of what happens when I put what I think is my Y position in the Vector3’s Y constructor parameter.

new Vector3((j * x) / 2, (i * z) / 2,0)

fail1

My camera is setup onSceneReady with

const camera = new ArcRotateCamera("p1", Math.PI / 2, Math.PI / 4, 1000, Vector3.Zero(), scene);
camera.attachControl(true);

Hi @tomkcey and welcome to the forum. Babylon.js is a left handed system with Y upwards.