Is there a way in Three.js to change the world position of a child?
My ultimate goal:
1) Separate the child from the parent (without changing the location)
2) Move the parent to another place
3) Reconnect the child (without changing the location)
In my code, the “child” is actually a group of objects (and I want to keep them in the same world position)
Currently, I have reached 1 and 2 as follows:
scene.updateMatrixWorld();
var vector = new THREE.Vector3();
vector.setFromMatrixPosition( child.matrixWorld );
grandParent.remove( parent );
scene.add( parent );
parent.children[0].position = vector;
I tried to modify the process described above by saving matrixWorld and updating it to the saved value, but was unsuccessful. I know that modifying the World matrix is not recommended, but this is the only method that has proven fruitful.