CSG behaves different between bjs meshes and gltf meshes

Hello guys,

I noticed that csg leads to different results if you cut a bjs mesh like meshBuilder.CreateBox and if you cut an imported gltf mesh.

You can see this here: https://playground.babylonjs.com/#C4B8QB#49

It seems to have something to do with rightHandedSystem. Turning it off changes the behavior but there is still a difference between both boxes.

Any idea how to solve this? The imported mesh should behave the same way like the bjs one.

Best

This must be a right-handed system issue, as you have already noticed. CSG is using the vertex data, which is unmodified by the parent root node transformation. Probably should be taken into account :slight_smile:

To avoid this issue, you can bake the current transformation to the root node of the glTF loaded - Babylon.js Playground (babylonjs.com) (notice line 21). That’s for left handed systems.
I have to admit I am not sure what happened with the right handed system, but I can only assume it has something to do with the way CSG is reading the vertex data. We can investigate that, you can submit a github issue if you wish. Please link this topic (and the playground) in the github issue

1 Like

Thanks, @RaananW.

I will create a GitHub issue!

1 Like