setPivotPoint without changing the position of mesh

Hi guys.

I need your help. Here is playground for my issue

https://www.babylonjs-playground.com/#4UR12G#6

So at the start I have pivot (redSphere) in the sphere origin.

image

Now I want to move pivot somewhere else (only enabled Z axis in the playground)

And I can rotate the mesh and it rotates around the new pivot point position

Now I want to change pivot position again, but I want mesh to stay at the same position, and after I rotate it again it will then rotate around newly defined pivot point position.

At the moment If I change the pivot point, the mesh will follow

I understand that this is supposed to happen, as I change pivot position and that same rotation is still applied to the sphere, but now around new pivot position.

So I am kinda aware that I have to reset rotation before changing the pivot again, but I tried some things and I couldn’t figure out how to do it properly.

I appreciate any help.

Thanks.