Select a material

Hi everyone,

I’d like to know if it’s possible to select a material of a mesh with a picking function.

If the mesh has only one material, it’s easy with something like this

var pickResult = scene.pick(scene.pointerX, scene.pointerY);

    if(pickResult.hit) {

        console.log(pickResult.pickedMesh.material)
   }

But if the mesh has more than one material…

Could you help me ?

Thanks,

Boris

1 Like

Here you go : https://playground.babylonjs.com/#2Q4S2S#593

You can see how to find it from a multimaterial :slight_smile:

6 Likes