# renderingGroupId and click detection

**URL:** <https://forum.babylonjs.com/t/renderinggroupid-and-click-detection/28150>\
**Category:** Questions\
**Tags:** prepassrenderer, mesh\
**Created:** [March 4, 2022, 7:28am UTC](https://forum.babylonjs.com/t/renderinggroupid-and-click-detection/28150 "2022-03-04T07:28:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [March 4, 2022, 9:09am UTC](https://forum.babylonjs.com/t/renderinggroupid-and-click-detection/28150/2 "2022-03-04T09:09:02Z")

</div>

Hey welcome!

You can use this code snippet to multiPick:

```auto
    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.

🖖

---

_[View the full topic](https://forum.babylonjs.com/t/renderinggroupid-and-click-detection/28150)._
