Hi,
Thank you so much.
May I ask why it is “new BABYLON.Vector3(-2.5, 2.5, 0)”? Is it local position or world position?
I used “myBox.getAbsolutePivotPoint()” before setPivotPoint and the output is {X: 0 Y:0 Z:0}.
From my understanding, the absolute pivot would not be (0,0,0) after I move the box to (5, 2.5, 0) on the line 15. Could you help me? Thanks!
Your box is 5 units. The pivot being in the center, I back 2.5 on the X axis and then back up 2.5 on the Y axis so that the pivot is at the level of the sphere.
In the above PG, notice I added two lines: 25/26. Run your scene and look at console. Notice the difference.
Now change your box position in lines 15/16. Run again. See how the “absolute” (worldspace) version… changes pivot location along-with the mesh’s (worldSpace) position.
The non-absolute localSpace pivotpoint… does not change. It is at the same localSpace position (as measured from center of box), no matter where within worldSpace… that you position the box.
With me? I hope so. It takes some time/practice to determine WHEN something is measured/positioned in localSpace, and when in worldSpace. I hope I was helpful.
Sorry, I got confused again. https://www.babylonjs-playground.com/#2Z4ERD#4
I printed the local and world positions of pivot in lines 18/19 and they are both (0,0,0).
However, myBox has been moved to (5,2.5,0) in lines 15/16, so why the worldSpace pivotpoint isn’t (5, 2.5, 0)?