In three.js how to replace parent object's children object with some object

var parent = replacee_object.parent;
var position = new THREE.Vector3();
parent.updateMatrixWorld();
position = replacee_object.matrixWorld;

// remove replacee_object;
parent.remove(replacee_object);

// add replacer_object
parent.add(replacer_object);
replacer_object.setPosition(position);

Have a look at THREE.SceneUtils and its .attach() and .detach() methods.

1 Like