Closed wang1212 closed 2 months ago
Hi @wang1212, thank you for pointing this out. There was indeed a bug in the remove function. The intention was not to make object.name mandatory. I just published release 1.7.0, which fixes this. Now all objects, whose name is undefined won't be removed when calling InteractionManager.remove(...) with an object whose name is undefined.
A common programming idiom is to call
add()
when the object (interactive) is created, and then callremove()
when the object is destroyed.However, due to the lack of understanding of the source code details, if the
name
field of the object is not assigned, it will cause all objects calledremove()
to be removed.https://github.com/markuslerner/THREE.Interactive/blob/v1.6.1/src/index.ts#L223
So, if I understand correctly, the
name
field value of a 3D object should be unique? If yes, is this critical and should it be specifically mentioned in the docs?