isPickable not firing on complex meshes

I have been having an issue where ispickable works fine if a mesh is a simple primitive, but seem to not fire the pick event (or even detecting it needs to) when meshes are nested or complex, despite isPickable being set.

This is my class: https://playground.babylonjs.com/#M6RE0H#2

Am I just not initializing this correctly, or what is (not) happening? When I go to pick a complex mesh it’s like they don’t have an isPickable set (cursor wont change, nothing fires when I click), though it works fine with the primitive “NoMesh” mesh. isPickable is showing set to true for both simple and complex meshes in the scene debug layer GUI, something just seems to be stopping it from ever being fired.

You should provide a working example :slight_smile:

Does the playground compile typescript?

Maybe this will be simpler.

Why does A have all of its Mesh class properties, but B would not. They both appear to be class MESH. I bet due to scope I am loosing that click event before its ever called, but need to know why there is a difference when, in the class linked above, they basically are created the same way.

Image A - Notice full class properties

Image B - Notice only transformation info is visible and very limited general options (no isPickable). Why is A and B different?

OK, so my issue seems to be related to this:

If a single mesh is a child of a mesh or of a transformNode then isPickable works as expected, even with a custom imported mesh.

If I have more than one childNode then if you set isPickable nothing happens when you go to interact with that node or it’s children.

So, what would cause nothing to happen if there is more than one mesh nested as a child of a parent?

Hi C!

I built a little testing playground… https://playground.babylonjs.com/#129LNB#3

Master parent (gray box on top) is set isPickable = false.

Master parent has 4 children, red, green, blue, and yellow.

Each of THOSE has 4 children… who inherit their parent’s color.

And lastly, each of THOSE has 4 children… who inherit their parent’s color.

In lines 60-67, I loop-thru all scene.meshes… looking for isPickable == false. Only box0.

You can click-on any box (except master parent), and it should report its name… at console.

It seems to be acting correctly, multiple children… of multiple children… of multiple children.

So, hmm. I suspect there may be some other/different picking problem with your scene, Calsa.

Let’s keep thinking-about what might be happening. Report any discoveries, please. Thx!

1 Like

Much appreciated!

1 Like