Is it possible to manipulate the global position of a child object in Three.js?
My main objective is to:
1) Unlink the child from its parent (without changing its location)
2) Move the parent to a different position
3) Reconnect the child (without altering its location)
In my scenario, the 'child' is actually a group of objects (and I want to maintain their original global positions)
So far, I have successfully accomplished steps 1 and 2 using the following method:
scene.updateMatrixWorld();
var vector = new THREE.Vector3();
vector.setFromMatrixPosition( child.matrixWorld );
grandParent.remove( parent );
scene.add( parent );
parent.children[0].position = vector;
When attempting to reverse the process by saving and updating the matrixWorld to its original value, I encountered difficulties. I understand that modifying the matrixWorld directly is not recommended, but it has been the most effective approach thus far.