renderingGroupId and click detection

Hey welcome!

You can use this code snippet to multiPick:

    scene.onPointerObservable.add((e) => {
        if (e.type === BABYLON.PointerEventTypes.POINTERDOWN) {
            const pickedMeshes = scene.multiPick(scene.pointerX, scene.pointerY);            
            console.log(pickedMeshes)            
        }
    })

You get all the meshes picked in the pickedMeshes array. The only thing you need to do is implement your custom logic, for example you can sort the meshes by the value of renderingGroupId and process them in that order.

If you need more assistance just let me know.

:vulcan_salute:

1 Like