Hello, it’s me again with another question
I created some cylinder mesh and i would like to move the origin (which is currently the center of the mesh) to the bottom. I googled a bit and found the pivots: https://doc.babylonjs.com/how_to/pivots
So i used the
mesh.setPivotMatrix(BABYLON.Matrix.Translation(-x, -y, -z), false); function and it seemed to work alright.
However when setting the position inside a PointerDragBehavior it works differently than i expected it.
The following playground describes my problem:
https://www.babylonjs-playground.com/#28YUR5#711 (line 62 and following).
At line 69 i set the position to (0, 0, 0) after applying the pivot matrix, and it sets the bottom of the cylinder to world coordinates (0, 0, 0). However when i execute the same line inside the PointerDragBehavior (when i end the drag) (line 77), it moves the cylinder too far down. After dragging the center of the mesh is at (0, 0, 0).
I don’t really understand why line 69 and line 77 move the mesh to different positions.
Is it somehow possible to set the origin of a mesh a different way, so when setting the position of this cylinder, it places the bottom of the cylinder to that position?