Remove a mesh from light.excludedMeshes

Hello !

When removing a mesh from the excludedMeshes array of a light, it doesn’t work, the mesh keeps unlighted
Can be currently fixed by toggling the light with setEnable false/true

Here a PG:

Indeed I think it’s not normal :thinking: Let’s have the official devs see this.


NB : Watch out with the use of setInterval in the Playground : it’s not cleared when you edit the code and run (play button) again since it’s pure javascript and not BabylonJS related.

Then you have 2 intervals running in parallel on top of eachother, then 3, 4, etc…
(Most of the time with no impact since most likely the objects would be disposed, but just for you to know, it can be source of lot of playground bugs)

1 Like

Yes, it’s expected, because you recreate the array itself. You should just remove the light:

2 Likes