GizmoManager and mesh.setPivotPoint

I want to move the pivot point that the GizmoManager rotates my mesh around, but when I use setPivotPoint the rotation gizmos act all weird rotating off into never never land. Is this a bug? Is there a workaround?

See gizmoManager and pivot points | Babylon.js Playground (

Okay so I believe I know what you are trying to accomplish. I noticed the gizmo was centered at the cat’s head, which looks ackward- (occurs this way due to importing 3d content?), and you created the sphere to visually show where you are trying to set the pivot point. You want the gizmo to be more centered toward the middle of the cat mesh, I’m assuming? If thats the case, the easiest way I found to do this was to attach the gizmo to the sphere, and set the sphere as the parent of the mesh:

Lines 34-36 are the only things changed. You can set the visibility of the sphere to isVisible=false (which can be done outside of importMesh callback of course, I just did it there in a hurry). You can simply change the Vector3 pivot position to adjust how its centered.

Hope that helps.

1 Like

Wow, I see - that’s fantastic thanks! I also like the little isVisible touch because that’s exactly what I want. And of course it doesn’t need to be a sphere, so this works too:

`var pivotParent = new BABYLON.Mesh(“pivot”);

Perhaps the GizmoManager should do this automatically when it finds a mesh with a pivot point set ?

1 Like

Tbh, I personally am not one of the devs of the BABYLON library, and I’m not sure why it was going all over the place. I’d hate to guess and be totally off. I just saw that as the easiest way to accomplish what it looked like you wanted to do.