SetPivotMatrix with Gizmo


When I move the pivot point, the gizmo is not correctly positioned.

Here is a PG for better understand:

Edite the value Translation(1, 1, 1) line 28 to see the problem.
Also edit the position of the box to put it back in the center of the world to see that it works as it should. I noticed that it works well when the box has the position 0,0,0, but not when the box is no longer in the center of the world.

Thanks @trevordev

@Dad72 If I understand your issue, I think


is causing the translation you added to be baked as well. Could you not cache the position, do your changes and then set the position back?


1 Like

Works well. Thank you Trevor

1 Like

I made a few improvements to make it work perfectly.

I removed :box.setPivotMatrix(BABYLON.Matrix.Identity());
And I added :
box.position.set(-box.getPivotMatrix().getTranslation().x, -box.getPivotMatrix().getTranslation().y, -box.getPivotMatrix().getTranslation().z);
instead of
so that I can recover the new pivot transformation with box.getPivotMatrix().getTranslation() and reset it to zero or some other value.

1 Like