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.
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 set(0,0,0)
so that I can recover the new pivot transformation with box.getPivotMatrix().getTranslation() and reset it to zero or some other value.