Multipicking has incorrect order for newly created meshes

Hello babylon crew! Hope you are all well!
I believe I’ve found an issue with the order of the scene.multipick function. For all objects created during “runtime” (meaning after an initial scene setup), they seem to be put in the very “back” of the pick order. The normal scene.pick returns the correct first mesh hit regardless.

Repro PG:

Expected output
0, sphere2 (first hit)
1, sphere
2, ground (last hit)

actual output
0, sphere (should be second hit)
1, ground
2, sphere2 (should be first hit)

It is fully unsorted and simply in the order of the mesh being added to the scene.

This would change the order as well (moving the ground creation before the sphere)

This is mostly for perf as it is not always needed to be sorted. You could sort the result on your side by the distance.


Haha right, sorting by distance sounds like a good approach :sweat_smile:
Good to know, thanks for the explanation!
Wish you a great day!