# ActionManager.OnPickTrigger doesn't work

**URL:** <https://forum.babylonjs.com/t/actionmanager-onpicktrigger-doesnt-work/45751>\
**Category:** Questions\
**Tags:** actionmanager\
**Created:** [November 17, 2023, 4:38am UTC](https://forum.babylonjs.com/t/actionmanager-onpicktrigger-doesnt-work/45751 "2023-11-17T04:38:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chan\_PlusPlus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chan_plusplus/32/34307_2.png) [@Chan\_PlusPlus](https://forum.babylonjs.com/u/Chan_PlusPlus)\
**Post date:** [November 17, 2023, 4:38am UTC](https://forum.babylonjs.com/t/actionmanager-onpicktrigger-doesnt-work/45751/1 "2023-11-17T04:38:49Z")

</div>

This code is a part of my Booth class to create some board mesh with registered action.  
First of all, OnPointerOver and Down works well, but only PickTrigger doesn’t work on board mesh.  
To figure out the problem, i tried below solutions , but it didn’t work

- board.isPickable = true
- attachControl to my camera  
But it seems that ‘PickTrigger’ event just don’t work for every meshes.

```auto
public CreateBoardMesh() {
    for (let i = 0; i < 3; i++) {
      const board = MeshBuilder.CreateBox(
        `board-${i}-image`,
        {
          width: 2,
          height: 3.8,
          depth: 0.1,
        },
        this.scene
      );
      board.isPickable = true;
      board.parent = this.rootMesh;
      board.rotation.y = Math.PI / 2;
      board.position.set(3.6, 3, 0.715 + i * -2.5);
      board.edgesColor = new Color4(1, 1, 0, 0.7);
      board.edgesWidth = 5;

      const mat = new StandardMaterial("board-mat", this.scene);

      mat.diffuseColor = new Color3(1, 1, 1);
      mat.roughness = 0.5;
      mat.diffuseTexture = this.dummyTextures[Math.floor(Math.random() * 8)];
      board.material = mat;

      board.actionManager = new ActionManager(this.scene);
      board.actionManager.registerAction(
        new ExecuteCodeAction(ActionManager.OnPickUpTrigger, () => {
          alert("player clicked");
        })
      );
      board.actionManager.registerAction(
        new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, () => {
          board.enableEdgesRendering();
        })
      );
      board.actionManager.registerAction(
        new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, () => {
          board.disableEdgesRendering();
        })
      );
    }
  }

```

---

<div class="post-metadata">

**Author:** ![xiehangyun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xiehangyun/32/30777_2.png) [@xiehangyun](https://forum.babylonjs.com/u/xiehangyun)\
**Post date:** [November 17, 2023, 6:39am UTC](https://forum.babylonjs.com/t/actionmanager-onpicktrigger-doesnt-work/45751/2 "2023-11-17T06:39:33Z")

</div>

[Sprites Examples | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#YCY2IL#1882)  
I tried it out on playground, and OnPickUpTrigger worked  
Simply cut two lines of code:  
“board.parent = this.rootMesh;”  
“mat.diffuseTexture = this.dummyTextures[Math.floor(Math.random() \* 8)];”  
In addition, if you want to listen to user click behavior, it is recommended to use OnPickTrigger.  
However, I found that OnPickTrigger does not trigger when the mouse is blocked by another grid.

---

<div class="post-metadata">

**Author:** ![Chan\_PlusPlus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chan_plusplus/32/34307_2.png) [@Chan\_PlusPlus](https://forum.babylonjs.com/u/Chan_PlusPlus)\
**Post date:** [November 18, 2023, 12:10pm UTC](https://forum.babylonjs.com/t/actionmanager-onpicktrigger-doesnt-work/45751/3 "2023-11-18T12:10:26Z")

</div>

Thanks a lot!!!  
I figured what the problem was based on your solution.  
As you mentioned, my board mesh was being blocked by some of invisible collision meshes.
