Currently facing an issue where I am trying to update axis labels on a 3D plot by removing the old labels (implemented as sprites) before adding new ones. Unfortunately, I am experiencing difficulties. The previous labels seem to persist in the scene even after removal attempts. I am working with Three.js release 66.
To troubleshoot this problem, I decided to test it using the Three.js example scene available at . In order to remove all sprites every second, I added the following code snippet:
setInterval(removesprites, 1000);
Here is the function that removes these sprites:
function removesprites() {
for (var i = group.children.length-1; i>=0; i--) {
var sprite = group.children[i];
console.log("removing");
scene.remove(sprite);
}
}
All sprites are within an Object3D group. I came across a suggestion stating that objects should be removed in reverse order, which explains the backward loop implemented here. Yet, regardless of the looping approach used, the labels remain untouched. Any suggestions or insights would be greatly appreciated.