getBindedMeshes doesn't return LinesMesh objects

Hello everyone !

I encountered an issue today with line meshes !
It turns out that a material’s getBindedMeshes method doesn’t return the LinesMesh objects.

Check it out in the playground below :

While testing, i also found an additional surprising behavior :

Try replacing the line lines.material = lineMat; with lines.material = boxMat; and you’ll get a wireframe box :thinking:.

cc @AlitarSemiramis who has done some digging there yesterday already :slight_smile:

Looking :slight_smile:

Good catch @Lecornflake ! There was a bug on how LineMeshes handled materials, and I have added a PR to fix the issue with getBindedMeshes here:

Removing custom material variable inside of LineMesh by VicenteCartas · Pull Request #16767 · BabylonJS/Babylon.js

About the wireframe, that is expected. If you look at the LineMesh.ts code, in the material setter, it sets the material fillMode to LineListDrawMode:

Babylon.js/packages/dev/core/src/Meshes/linesMesh.ts at 862f455ee44f0476195407c998aae9f6075fe33e · BabylonJS/Babylon.js

So when you apply the box material to the line, fillMode gets changed and that’s why the box appears as a wireframe. Maybe something we should document, I will add a note.

Lightning fast fix as usual :high_voltage: ! Thanks a lot !