# Mesh picking by ray doesnt always work/ is not reliable

**URL:** <https://forum.babylonjs.com/t/mesh-picking-by-ray-doesnt-always-work-is-not-reliable/35091>\
**Category:** Questions\
**Created:** [October 24, 2022, 9:59pm UTC](https://forum.babylonjs.com/t/mesh-picking-by-ray-doesnt-always-work-is-not-reliable/35091 "2022-10-24T21:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [October 24, 2022, 9:59pm UTC](https://forum.babylonjs.com/t/mesh-picking-by-ray-doesnt-always-work-is-not-reliable/35091/1 "2022-10-24T21:59:36Z")

</div>

I am using the code from the “Fun with picking meshes” .  
Somehow the picking seems to be unreliable and doesnot always work.  
It seems especially clicking on the top of cubes doesnt seem to work as it should?

Or do I have a different flaw in the code?

picking is at Line 249

> **[Babylon.js Playground](https://playground.babylonjs.com/#AQM49M%2342)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Thanks! Werner.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 25, 2022, 3:03am UTC](https://forum.babylonjs.com/t/mesh-picking-by-ray-doesnt-always-work-is-not-reliable/35091/2 "2022-10-25T03:03:03Z")

</div>

visibility does not prevent picking or interaction, only rendering. To fully disable the cube on picking you could use setEnable [https://playground.babylonjs.com/#AQM49M#44](https://playground.babylonjs.com/#AQM49M#44)

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [October 25, 2022, 7:13am UTC](https://forum.babylonjs.com/t/mesh-picking-by-ray-doesnt-always-work-is-not-reliable/35091/3 "2022-10-25T07:13:15Z")

</div>

Thank you!  
argh, I almost solved it on my own ;).  
I already had the feeling that setting the visibility was the issue.

fantastic.
