I have added some mesh elements using for loop. then added that in the scene. Now I need to select it and i have a button to delete in dat.gui . So i need to delete that through that button. I use following lines to delete
if(currently_selected_object !== null) {
scene.remove(currently_selected_object);
currently_selected_object.geometry.dispose();
currently_selected_object.material.dispose();
console.log('delete');
animate();
}
currently selected object is defined on intersect using mouse. After selecting an object. I clicked on the delete button. It is just removed from the scene. But it is available in itâs place as invisible. If I select in that place. it shows following error.
âUncaught TypeError: Cannot read property âmatrixWorldâ of null.â. So I canât select the object which was behind to the deleted object. Please help me