CSG Issue with merged materials

Hi everybody,

I have an issue when i try to subtract a CSG mesh with another which is already merged and has several colors.

Case 1 : my merged mesh is not cut :

image

Case 2 : my merged mesh is cut by another one

image

Here’s my PG : https://playground.babylonjs.com/#FL50RB#3

I don’t know if its a bug in my code or in Babylon.

Could you help me ?

Thanks in advance,

Boris

Wide guess time. Anytime you have 2 operations in series, which work separately but not together, switching the order should be the first thing to try. This should be written down somewhere :grinning:.

Do the cut(s) first, then merge, & report back, please.

You can use the “keepSubMeshes” of the toMesh function call:

PS: I like your avatar almost as much as mine :slight_smile:

Thanks for all @Evgeni_Popov, your solution is easier to use than swiching the order of the tasks. Thanks anyway, @JCPalmer

Captain caveman’s team forever !!! :grin: