Background: Object can be pivoted using their buffer geometries by using by applying .translate() method. It is different than setting the position, meaning it doesn’t change the origin, and only offsets all vertices.
What if I want to know this translation? It is a good assumption to make (also as per experience) to get objects which are composed of multiple objects themselves all of which have the origin set to (0, 0, 0) but pivoted. This is all the more valid for multi-geometry objects fetched from 3D warehouses.
Question: How can I know the object translation vector?
This statement needs a clarification. You are not using .makeTranslation() which is actually a method of Matrix4 but BufferGeometry.translate(). This method will offset the vertices of a geometry and thus changing the pivot point.
I personally tend to avoid this approach since it’s more flexibel to keep the geometry in its original state. The other option is to use an additional Object3D in order to represent the pivot point. The approach looks like so:
mesh.position.set( 1, 1, 1 );
var pivot = new THREE.Object3D();
pivot.add( mesh );
Have you considered to use this option in your app?
My bad. I should have been clearer in my statement. I have come to know what it does, and hence I will edit that.
Yeah there were two approaches to have that done, as you rightly pointed out. I just chose the first one since I didn’t encounter any use case till now where the second one, what you highlighted, was a clear winner. My choice was a coin toss until now. I will give it a try as I am sure you are speaking from your experience.