# Pick with bounding box

**URL:** <https://forum.babylonjs.com/t/pick-with-bounding-box/41605>\
**Category:** Questions\
**Created:** [June 14, 2023, 8:37am UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605 "2023-06-14T08:37:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perpleex](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/perpleex/32/19692_2.png) [@Perpleex](https://forum.babylonjs.com/u/Perpleex)\
**Post date:** [June 14, 2023, 8:37am UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/1 "2023-06-14T08:37:07Z")

</div>

Hello,  
I want to know if it’s possible to choose the type of ray on scene mouse Event like scene.onPointerDown.  
I need to select mesh by bounding box and actually i create a new ray with scene.pickWithBoundingInfo with mouse coordinate from the event.  
But if i can avoid a new ray he can be better.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 14, 2023, 9:54am UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/2 "2023-06-14T09:54:12Z")

</div>

Hi!

Can I ask - what do you mean by “type of ray”?

---

<div class="post-metadata">

**Author:** ![Perpleex](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/perpleex/32/19692_2.png) [@Perpleex](https://forum.babylonjs.com/u/Perpleex)\
**Post date:** [June 14, 2023, 1:48pm UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/3 "2023-06-14T13:48:32Z")

</div>

A way to change the initiator who create the pickingInfo in the event to use boundingbox for picking mesh.  
And avoid to recreate a new pick.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 14, 2023, 2:35pm UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/4 "2023-06-14T14:35:31Z")

</div>

That’s a great suggestion! Can be a part of the input manager.  
Can you create a github issue describing this? You can reference this forum chat.

CC @PolygonalSun

---

<div class="post-metadata">

**Author:** ![Perpleex](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/perpleex/32/19692_2.png) [@Perpleex](https://forum.babylonjs.com/u/Perpleex)\
**Post date:** [July 4, 2023, 1:08pm UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/5 "2023-07-04T13:08:39Z")

</div>

Thanks for the implementation but actually the fastCheck not return element by boundingBox it’s another parameter “onlyBoundingInfo”. On internal ray.

This argument  
/\*\* @internal \*/  
\_internalPick(  
rayFunction: (world: Matrix, enableDistantPicking: boolean) =\> Ray,  
predicate?: (mesh: AbstractMesh) =\> boolean,  
fastCheck?: boolean,  
onlyBoundingInfo?: boolean,  
trianglePredicate?: TrianglePickingPredicate  
): PickingInfo;

In my useCase i want to select mesh by bounding box because her geometry aren’t totally plain they have some hole.

It’s possible to also expose this parameter on the input manager ?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [July 5, 2023, 9:34am UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/6 "2023-07-05T09:34:25Z")

</div>

Sure, makes sense to expose that as well. @PolygonalSun , any thoughts?

---

<div class="post-metadata">

**Author:** ![phaselock](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@phaselock](https://forum.babylonjs.com/u/phaselock)\
**Post date:** [July 26, 2023, 8:41am UTC](https://forum.babylonjs.com/t/pick-with-bounding-box/41605/7 "2023-07-26T08:41:55Z")

</div>

Should `actionManager` should also benefit from the change? `usePreciseIntersection:false` or somesuch for existing triggers? It might be breaking tho, unless we add new triggers…
