Proper way to remove object and CSS2DObject associated

Hi,

I have modified the fiddle.

There is what I have added from your fiddle :

 	var controls = new OrbitControls( camera, labelRenderer.domElement );
    controls.minDistance = 5;
    controls.maxDistance = 100;

  // there is the remove event. if you click you can remove the moon but the label "Moon" won't be removed

 document.addEventListener("click",function(){
 scene.remove(moon);
 })

I have removed your function :

setTimeout( function () {

	moon.remove( moonLabel );

}, 1000 );

https://jsfiddle.net/charlieWhite84/b9adv0s4/4/

1 Like