Problem with position mesh from CSG

Hi,

I create a tube mesh by subtracting two CSG meshes. After that, I want to add gizmoMenager to rotate and move this mash. But the gizmo creates at the center of the scene, not at the center of the mesh. I think that problem is that this mesh has the position and absolute position set to 0, 0, 0 but as you can see in the playground it is not in that position. Maybe this mash has its own matrix. So I tried to change the matrix to the world but I failed. Could you help me to set the gizmo to the center of the mash?

Link to the playground:

One approach would be to use the center point as set in the bounding info, negate it and apply it to the position.

Then use this to bake the transformation into the mesh, essentially “centering” it:

Babylon.js Playground (babylonjs.com)

2 Likes

That’s exactly what I was missing. Thanks a lot!

1 Like