# Include thinInstanceIndex for OnPointerOverTrigger, OnPointerOutTrigger

**URL:** <https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273>\
**Category:** Feature requests\
**Created:** [August 22, 2021, 7:41pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273 "2021-08-22T19:41:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![saaratrix](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/saaratrix/32/25270_2.png) [@saaratrix](https://forum.babylonjs.com/u/saaratrix)\
**Post date:** [August 22, 2021, 7:41pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/1 "2021-08-22T19:41:41Z")

</div>

Hi, I’ve been working with thin instances and pointer events using the action manager. Would it be possible to include the thinInstanceIndex when you hover a mesh that has thin instances? Or maybe even a different over & out events for each thin instance?

It might be too specific to the project I’m working on as we store different data based on the thin instance index but I feel that it might be useful as instanced meshes for comparison would trigger individual events.

The data sort of already exists as we have a picking result here:

> <https://github.com/BabylonJS/Babylon.js/blob/2998a4a96c1da1ca170fdf9c6a37bbabb106a38e/src/Inputs/scene.inputManager.ts#L201>

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 23, 2021, 8:06am UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/2 "2021-08-23T08:06:15Z")

</div>

Welcome aboard!

Could you setup a small repro in the Playground? I think all picking methods in Babylon are using the same underlying code, and thin instances are handled by this code: you get the thin instance index in the `thinInstanceIndex` property of the `PickingInfo` structure.

So, I feel it should work. Have you enabled thin instances picking with `mesh.thinInstanceEnablePicking = true`?

---

<div class="post-metadata">

**Author:** ![saaratrix](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/saaratrix/32/25270_2.png) [@saaratrix](https://forum.babylonjs.com/u/saaratrix)\
**Post date:** [August 25, 2021, 8:26pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/3 "2021-08-25T20:26:30Z")

</div>

Thanks!

I set up a playground that tried to convey what feature could be missing. If using the action manager we don’t know what thin instance index is pointer over/out. Whereas for instanced meshes the action manager would trigger for each instance.

But as I wrote this might be too specific to the project I’m working on and can be solved just using scene.pick().

Hopefully it’s not too confusing what the texts mean when hovering the 4 different spheres.  
[https://playground.babylonjs.com/#3H8B60](https://playground.babylonjs.com/#3H8B60)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 25, 2021, 9:16pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/4 "2021-08-25T21:16:57Z")

</div>

When this PR is merged:

> <https://github.com/BabylonJS/Babylon.js/pull/10931>
>
> See https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertri…gger-onpointerouttrigger/23273/3

You will be able to access the `pickResult` structure used to trigger the on pointer out/over events of the `ActionManager` through `event.additionalData.pickResult`. So no need to issue an additional `scene.pick` query.

---

<div class="post-metadata">

**Author:** ![tibotiber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tibotiber/32/26735_2.png) [@tibotiber](https://forum.babylonjs.com/u/tibotiber)\
**Post date:** [October 21, 2021, 12:57pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/5 "2021-10-21T12:57:06Z")

</div>

This is exactly what I needed today, love the power of this community 🎉.

One nitpick, I found it confusing that `pickResult` was nested under `additionalData` instead of spread into the object. It makes it inconsistent with the object available on other triggers. For instance, I would have expected the following:

```auto
actionManager.processTrigger(Constants.ACTION_OnPointerOverTrigger, ActionEvent.CreateNew(mesh, undefined, { pointerId, ...pickResult }));

```

at [ActionManager: pass pickResult to pointer out / over triggers by Popov72 · Pull Request #10931 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/10931/files#diff-b2f8ea1f7c6d90a160cb60fabd7689dbdefa75ebaefd75fff03aa92ad871982fR943). I’ve added the `...` to spread the object.

Thanks for this @saaratrix and @Evgeni_Popov.

---

<div class="post-metadata">

**Author:** ![romainE](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/romaine/32/26774_2.png) [@romainE](https://forum.babylonjs.com/u/romainE)\
**Post date:** [September 6, 2022, 1:46am UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/6 "2022-09-06T01:46:47Z")

</div>

Hi @Evgeni_Popov , BabylonJS newbie here (loving it already!).

Following up on this question, it seems like `OnPointerOverTrigger` doesn’t trigger when we move the pointer from one thin instance to another without interruption. What would be the best way to trigger anytime a thin instance is picked (even if they overlap)?

I’ve tweaked the original playground a bit to reproduce: [https://playground.babylonjs.com/#3H8B60#3](https://playground.babylonjs.com/#3H8B60#3)

---

<div class="post-metadata">

**Author:** ![axeljaeger](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/axeljaeger/32/21445_2.png) [@axeljaeger](https://forum.babylonjs.com/u/axeljaeger)\
**Post date:** [October 19, 2022, 1:58pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/7 "2022-10-19T13:58:23Z")

</div>

We have the same problem here: An application here that is basically using ThinInstances for everything and we had to implement our own pick logic as we were suffering from the fact that we do not get an event when moving from one ThinInstance to another. If there was a solution for registering for such events, we could remove a lot of custom code out of our application!

---

<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 19, 2022, 2:56pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/8 "2022-10-19T14:56:40Z")

</div>

cc @Evgeni_Popov in case he missed the post the first time

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 19, 2022, 5:04pm UTC](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/9 "2022-10-19T17:04:12Z")

</div>

Already fixed here:

> [@Trigger OnPointerOverTrigger when hovering between 2 thin instances](https://forum.babylonjs.com/t/trigger-onpointerovertrigger-when-hovering-between-2-thin-instances/33943):
>
> (Copied from [Include thinInstanceIndex for OnPointerOverTrigger, OnPointerOutTrigger - #6 by romainE](https://forum.babylonjs.com/t/include-thininstanceindex-for-onpointerovertrigger-onpointerouttrigger/23273/6)) Hi, BabylonJS newbie here (loving it!). It seems like OnPointerOverTrigger doesn’t trigger when we move the pointer from one thin instance to another without interruption. See this playground as an example: [https://playground.babylonjs.com/#3H8B60#3](https://playground.babylonjs.com/#3H8B60#3) Would it be possible to add an option for it, if it doesn’t exist already?
