Cut a whole group of meshes

Hi everyone,
I’m currently trying to curve cut several meshes at the same time. For this, I use the intersect() method with a sphere.

Here is what I have for the moment : https://playground.babylonjs.com/#2GA9QH#1

I first tried to use the “CurveCutOneByOne” method, which applies the cut to the meshes one at a time. It works, but as you can see, this is really slow even for only 2 meshes.

So I thought it would be interesting to group the meshes into a parent and to apply the cut directly to this parent. This is what I’m trying to do in the “CurveCut2” method but it doesn’t work with what I’ve done.

Have you got any idea of what could be done to do this cut faster than with the CurveCutOneByOne method?

Thank you for your time ! :smiley:
Lyzo

Adding a parent to CSG won’t work as you expect it to. CSG requires each mesh to be analyzed and processed.

What you can do to (maybe?) speed up the process is to merge the meshes you are about to cut:

curve cut a parent | Babylon.js Playground (babylonjs.com)

But I am not sure if it fits your usecase

3 Likes

Thank you for your answer.

I tried to merge all the meshes I had to cut. We only have to do 1 cut instead of x cuts so this is way faster.

Also, this is the last operation I have to do with my meshes, I don’t need to move them separatly after the cut, so the merge is not a problem for my use.

Thank you for your help !

[EDIT] : An other way to accelerate the process is to use a cylinder instead of a sphere, calculation is way easier for Babylon. I didn’t think about it…

1 Like