SelectionBox and InstancedMesh


I am working on a threejs application in which the user can drag the mouse to create a selection area which puts the objects in context. The idea is very similar to the example: three.js webgl - box selection. The example was very helpful to start with (thank you by the way!).

The only difference between the example to my implementation is that I am using an instanced mesh to render my objects (as opposed to individual meshes). I noticed that the selection area I am drawing is not giving me the instance ids out of the mesh. When I am selecting an area which contains parts of the instanced mesh, the function just returns the instanced mesh object.

Is there a way to know which instanced mesh ids I am selecting? when I use raycaster and cast a ray onto an instanced mesh, I am getting the instanceId property back. I was wondering if there is a way to do something similar with SelectionBox.

Thank you,

Hello Three js Team,

I am also looking for this feature. Please help me in this. Any suggestion on the above requirements.

@Mugen87 & @prisoner849 your points or suggestion are valuable a lot.


It’s available, I guess not put in types yet,
You can get the instances from selectionBox.instances after calling
Also need to reset it before select by selectionBox.instances = {}

1 Like

Yeah it was added recently