After using CSG-subtract the position of the two (or more) subtracted meshes stay the same as the previous one (relative to the new one) before using CSG. thus when attaching these meshes to a gizmo, the gizmo is at a wrong position ( at the previous mesh, which doesn’t existing anymore), instead of being in the center of the mesh. It’s a bit hard to explain, just click at the two hemispheres and you’ll see what I mean:
thanks, but that works for that case only, I’ve tried figuring out the center of the mesh and translating the pivot towards it, but I can’t figure it out. I tried getting it through the bounding box, but only crap comes out (as the little sphere shows).
var oldPivotTranslation = newMesh.getBoundingInfo().boundingBox.centerWorld.clone();
var sphere = BABYLON.Mesh.CreateSphere(“sphere”, 15, 1, scene);
sphere.position = oldPivotTranslation
Why is that? I mean the bounding box is correctly around the hemisphere (as seen below). Why doesn’t getBoundingInfo().boundingBox.centerWorld give me that position?