Threejs detach child object from its parent

I am attaching child object to parent using .attach() method.(Too keep the object’s world transformation)
I want to detach that specific child object from its parent.

What can be the possible solution…?

Try this:

const parent = object.parent;
parent.remove( object );

object.matrixWorld.decompose( object.position, object.quaternion, object.scale );
3 Likes

BTW for anyone arriving via search engine like I did, there is now object3d.removeFromParent():

https://threejs.org/docs/index.html?q=obje#api/en/core/Object3D.removeFromParent

1 Like