Assigning a material to an .stl in an assetcontainer

Hi again,

I have worked out / been shown how to load meshes into asset containers which allows me to then turn them on and off in a scene using the GUI. However, to date I have only done this with .babylon files exported from blender. I have also worked out how to load a .stl file into an asset container but what I cant work out is how to assign a material to the .stl in the container.

I’ve attached a playground which has both the material, the stl in the container and an on/off behaviour via a gui. I would be greatful if someone could show me how to assign the material to the .stl?

Thanks,
Sy

https://playground.babylonjs.com/#CCR9FQ#9

Hi insidef1,

I added lines 16 and 17 to just apply your material to the first mesh (which is usually the root) in your loaded asset container. Does this achieve the effect you’re looking for?

BlendWebMix | Babylon.js Playground (babylonjs.com)

1 Like

Hello!

it most certainly is! Than you so much!

Perfect!
Sy