Remove mesh from highlight layer

Dear Forum

I’ve added a highlight layer, but i can’t remove any meshes from it after adding them.
The playground is from somebody else, who did a “hili._meshes = [];” at the end to remove the highlights. But i can’t use that, as the materials are all black afterwards.

Playground: (click on the ground should make the highlights disapear)

Thank you!

removeIncludedMesh does not exist, you had some errors in the console log:

yes thank you sorry

so it works like this. In my use case the actual problem seems to be the root parent from the gltf import. root.getChildren() ist not working - i have to search for some other ways to adress the meshes within the root parent

I think the PG you linked is ok?

here’s a repo of the problem:

Why does it work here?:

Don’t call removeMesh with a string but with an actual pointer to the mesh:

1 Like

thank you - great!

Ps: removing all meshes from the highlight layer at once don’t seems to be possible so far:

so i did it like that:

for (var i=0;i<scene.meshes.length;i++) {
var mesh = scene.meshes[i];

You can use removeAllMeshes() we added for this.