Scene.pick and rendering groups

I’d like scene.pick to return higher render layers before lower render layers.

For example in this PG:

I’d like scene.pick to return sphere2 (rendering group 1) instead of sphere1 when clicking on sphere2.

Do I need to do separate picks for each render layer to achieve this?

Hmm, maybe multiPick and sort by renderGroup & distance from camera ? :thinking:
Never used multiPick, looks like it just picks sphere1 multiple times, or rather picks multiple times at same distance

The picker will use only geometrical data and thus completely ignore the layers.
I think @aWeirdo idea is probably the best here. With multiPick you should be able to get all meshes and then be able to sort by renderingGroupId

I used the idea that @aWeirdo provided in this playground:

Hope it goes in the right direction and can help you :blush:

1 Like

The solution / hack a came up with was overriding scene._internalPick.