Include thinInstanceIndex for OnPointerOverTrigger, OnPointerOutTrigger

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:

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?

1 Like


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.

When this PR is merged:

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.


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

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:

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. I’ve added the ... to spread the object.

Thanks for this @saaratrix and @Evgeni_Popov.