Instanced mesh of type MeshBuilder.CreateRibbon is not showing

Hi everyone!
I’m new to the babylon.js and have trouble with instances.

This is how i create main mesh with normal material, also tried with material for instances

this.main.mesh = BB.MeshBuilder.CreateRibbon(
  `main`,
  {
    pathArray: paths,
    sideOrientation: 2
  },
  this.scene
);

this.main.mesh.isVisible = true;
this.main.mesh.material = this.gMat;

And this is instance with Hahok as engine and PhysicsAggregate


const instance: InstancedMesh = MeshBuilder.CreateRibbon(
  `G-${GX}-${GZ}`, { 
    pathArray: paths, 
    sideOrientation: 1, 
    instance: this.main.mesh
  }, 
  this.scene
);

const groundAggregate = new PhysicsAggregate(
  instance,
  PhysicsShapeType.MESH,
  {
    friction: 0.9,
    mass: 0
  },
  this.scene
);

if (this.devSettings.debug.meshes && map.physicsBody) {
  this.physicsViewer.showBody(instance.physicsBody);
}

No matter what i do, material / color is not displayed on the instance, only grid from debugger

Also like that produce same result

const instance = this.main.mesh.createInstance(`G-${GX}-${GZ}`);

Here the optional parameter instance is an instance of an existing Ribbon object to be updated with the passed pathArray parameter.

So if you want to create a separate instance of the main.mesh, this should work
const instance = this.main.mesh.createInstance(G-${GX}-${GZ});

You right.
This code idd produce instance, my mistale.

const instance = this.main.mesh.createInstance(G-${GX}-${GZ});

But i can’t update “pathArray” in that case, after instance is created, right ?
And if so, i can’t make new shape out of it ?

And how is it possible that i can see whole terrain via Havok debug ?

You may use clones in this case.

A simple example in PG will help a lot.

I tried to do something like that, in the hope that i can adjust positions, but no effect

const _map = this.main.mesh.createInstance(`G-${GX}-${GZ}`);
map = BB.MeshBuilder.CreateRibbon(`G-${GX}-${GZ}`, { pathArray: paths, instance: _map }, this.scene);

And clone, is it just like creating new Mesh, or cheap as instance ?
I think instancing may be is not suitable for my task

It is cheaper than new Mesh, but not so cheap as instance :slight_smile:
But with clones you may need makeGeometryUnique() to create a un-shared specific occurence of the geometry for the mesh.

Will try. thank you