on the screenshot one can see an object (group) and the editor shows “pivot/helper axes” of the object - it’s from the threejs editor webpage
So it’s possible to get this information - but i can’t figure it out. Let’s imagine, i would like to have the pivot point located in another “corner” of the object (i.e. move it to the “left” corner).
How can i programmatically get this information from the object3d itself?
1.1 how to get position of the pivot/helper relative to the object (i.e. on the screenshot its at the lower right from vertex of the object bounding box)
How can i programmatically change the pivot position - for instance would like to have the pivot point located at the center of the lower z plane of the object’s bounding box
Right now i have a workaround - i do not get this information instead i make a “wrapper” object and position (center) internal object accordingly. It “simulates” change in pivot point position. It works well but modification of the “pivot” point seems more elegant.
As above - they are always drawn at object’s world-space position (which is equivalent to object’s local (0.0, 0.0, 0.0) position.) The location of that (0.0, 0.0, 0.0) point depends on the model itself - if you import the model in Blender and select it, this point will be marked with an orange dot:
threejs is fully aware of where is the “gizmo/handle/pivot/axes” - so it knows where is the objects (0,0,0) in the world coordinates (as mjurczyk noticed)
the difference between these two objects, with only “gizmo/axes/pivot” changed:
2.1 object’s matrix property index 13 is changed (26.4647534 changed into 65.8348321,22)
2.2 geometry’s vertices positions are changed (seem to be translated by -39 which is a difference between 26 and 64)
So it seems that “origin/pivot” is just object’s (0,0,0) as you said and when it’s modified (it was moved along the “red” axis) it results in object’s matrix position changed (geometry is translated).
Sorry but the statement stays - there’s no gizmo / pivot, so three can’t be aware of it. There’s just object position - and the geometry is constructed around that position (so if a geometry vertex in the Mesh is at position (20, 20, 20) and position of the Mesh is (4, 4, 4), then the position of that vertex will be (24, 24, 24).)
This behaviour depends exclusively on the a) software you use to create the model, b) exporter you use to export model from that software, c) output file format. Exporters may (or may not) choose to center the object in it’s “centre of gravity” before exporting, making the model look exactly the same regardless of where you’d move it before exporting. I can vouch only for Blender that it does not do so.
Long story short - imo there’s no value in trying to understand this. Personally I’d just write code that loads a model, calculates it’s bounding box, and then centres the model so that (0, 0, 0) will always mean centre of gravity for the given model. That way you’ll be able to load models with all kinds of random transformations and be sure that they’ll be aligned in the same, uniform way.