# onPickTrigger action issue

**URL:** <https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729>\
**Category:** Questions\
**Created:** [April 9, 2025, 12:58pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729 "2025-04-09T12:58:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 9, 2025, 12:58pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/1 "2025-04-09T12:58:55Z")

</div>

I have an issue where a mesh is in front of another mesh and I’m using the actionManager on the mesh to register an onPickTrigger for each sphere.

Clicking each sphere makes it disappear. Clicking quickly to trigger the blue (front) and red (back) sphere results in the red (back) sphere receiving a double pick instead of a single pick. The plane will disappear if the red sphere receives an onDoublePick action.

Is this a bug or is there a better method to register quick clicks on a mesh?

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

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 9, 2025, 1:27pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/2 "2025-04-09T13:27:52Z")

</div>

Hello 🙂

> [@slimboX](#):
>
> Is this a bug

Having a look at your code, I would say it’s not a bug :

- Single click triggers instantly
- Double click won’t “remove” the single click from the past

And then since you actually disable the sphere on single click, there is basically no chance to trigger a double click on it.

* * *

Eventually, you could set the “disappear” in some kind of a timeout, and disable this timeout on double click (adapt the delay with your speed need)

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

* * *

But anyway, I don’t know what is the usage, but I think you should try another UI mecanism than hiding on click, and not hidding + something else on double click

---

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 9, 2025, 1:40pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/3 "2025-04-09T13:40:10Z")

</div>

Thanks for your reply. The problem is the second click should trigger the red sphere. The blue sphere disappearing should allow for the second click to trigger the red sphere. The red sphere is receiving only only click but gets triggered as a double click.

This is for a game where the player needs to click items quickly to “destroy” them. I put this simple example together to figure out why certain meshes where not getting triggered. I discovered the double click trigger on the red (back) sphere by accident. I don’t want or need a double click action at all.

---

<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:** [April 9, 2025, 1:41pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/4 "2025-04-09T13:41:53Z")

</div>

Doubleclick is emulated by Babylon and not using native doubleclick events. You can define the delta time between two clicks to be considered a double click. I am not sure this is the solution you are looking for, but it’s one way of fixing it 🙂

The default time is 300ms. Reducing it to 100 - [https://playground.babylonjs.com/#TTQ6G7#2](https://playground.babylonjs.com/#TTQ6G7#2) works better. but then you will probably have hard time getting doubleclicks to work.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 9, 2025, 1:42pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/5 "2025-04-09T13:42:13Z")

</div>

> [@slimboX](#):
>
> I don’t want or need a double click action at all.

Ok then what about binding both single click and double click to the same action ? That way :

- Single click → OK
- Double click (a single click happened recently) → Still OK

---

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 9, 2025, 1:54pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/6 "2025-04-09T13:54:34Z")

</div>

I thought about that, but seems like a hack instead of just having the single click work as expected. I don’t understand why the red sphere receives a double click trigger when the first click triggers the blue sphere.

---

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 9, 2025, 2:04pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/7 "2025-04-09T14:04:39Z")

</div>

[RaananW](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/4)

Thanks! This is possibly what I’ll need to do. I don’t have any need for a doubleclick action, so this may be my solution. I tried disabling double click but didn’t seem to work.

Still troubles me that the red sphere receives a double click when it clearly only gets one click.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 9, 2025, 2:39pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/8 "2025-04-09T14:39:32Z")

</div>

> [@slimboX](#):
>
> Still troubles me that the red sphere receives a double click when it clearly only gets one click.

I didn’t have a look at the source code (so @RaananW will eventualy confirm) but I would say that the “double click” trigger is done in a global context (and not in a “per mesh” context). So what happens is, most likely :

- First click → Blue disappears
- Second click → `delay < doubleClickDelay == true` → Double Click Triggered → Red happens to be under the mouse since Blue is off → Red receives Double Click Event

Somehow, like if the `DoubleClick` was actually a `SimpleClick` with a flag “short delay” set to true

---

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 10, 2025, 1:51pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/9 "2025-04-10T13:51:54Z")

</div>

Thanks for that explanation. This makes sense, especially considering the double click delay trick that @RaananW works. I really appreciate you taking the time to help me out. I love this community! 🥰

---

<div class="post-metadata">

**Author:** ![slimboX](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/slimbox/32/37266_2.png) [@slimboX](https://forum.babylonjs.com/u/slimboX)\
**Post date:** [April 10, 2025, 1:58pm UTC](https://forum.babylonjs.com/t/onpicktrigger-action-issue/57729/10 "2025-04-10T13:58:18Z")

</div>

@RaananW Thanks again for your help. I chose this as the “solution” since it works well in my situation of not needing double clicks. It still seems odd about the red sphere receiving the double click though. If someone needed quick click registration AND double click ability, this would not work.

@Tricotou had a good explaination for it.
