CSG Intersection between 2 meshes

Hi everybody,

I have a problem when i want to make the intersection of 2 meshes, a box and a polygon

here’s the playground : https://playground.babylonjs.com/#WM8ZHJ#1

the color of the polygon is red.
the color of the box is green.
the intersection mesh color is blue

I don’t understand why the intersection mesh includes the upper side of the box.

Someone could help me ?

Thanks

Boris

Hello!

Do you want to get rid of this piece? The blue one?
image

Yes, I only want to keep the “real intersection” of the two meshes and delete also the upper side of the blue mesh

All your meshes/materials must use the same side orientation (and I’m not sure anything different from FRONTSIDE will work with CSG).

So, you should remove sideOrientation:BABYLON.Mesh.DOUBLESIDE from the polygon creation and make sure the vertices are listed with the right winding. It seems that inverting the creation of the vertices in pts and inverting the loop //base en bas make it work:

3 Likes

I’ve missed to respond. Didn’t get the notification neither an email, damned. I try to collect solutions :joy::joy::joy: