Error when creating CSG with custom Mesh

Hello here !

I’m surely having a common error, but here’s the deal :

I want to use CSG on a custom-made mesh, but I have a non-very explicit error when creating a CSG object from the mesh : Cannot read properties of null (reading '0')

Uncomment line 26 :

On a previous project, I saw that I did this before using the CSG.FromMesh thing : customMesh.subMeshes = []
But using this makes the error disappears, as well as my mesh …

CSG needs the normals, so you should call customMesh.createNormals(false); before calling BABYLON.CSG.FromMesh.

2 Likes