I have an array of Meshes, each Mesh containing its ID in a name property. I'm wondering if it's feasible to remove an object from the scene based on its specific ID. Here is an example:
var geo = some geometry;
var mat = some material;
for (var i = 0; i < 10; i++) {
var object = new THREE.Mesh(geo, mat);
object.name = i; // i would serve as ID in this case
}
After this process, I wish to delete/remove certain objects... Perhaps using a function like
remove(id);
....
var remove = function (id) {
... some magic
scene.remove(...) // this would remove the object with the passed id parameter
}
Is it possible to achieve this functionality?
Thank you!