Hi all, I am trying to incorpoate box selection in my three js scene. I am working off of the official example: https://threejs.org/examples/misc_boxselection.html
In my particular scene I have BoxGeometry objects and several OBJ models. When testing the code from the example, the box selection only worked when I changed geometry material to MeshLambertMaterial (otherwise it gave me this error:
Uncaught TypeError: Cannot read property ‘set’ of undefined
allSelected[ i ].material.emissive.set( 0xffffff );
It also gave the same error when I tried to select the OBJ models.
So I have 2 questions:
How do I prevent this error for selecting the OBJ Models? (as it doesn’t seem possible to change the OBJs to lambert while keeping their associated MTL files).
Is there some way to only select the OBJ models so that even if the geometry is within the bounds of the selection box it isn’t selected? (without just changing the material back to a Phong material as this causes errors).