How to Pick loaded assets?

Hi all,

I’m trying to implement a gizmo attachment logic manually, but PointerEventTypes.POINTERPICK events don’t seem to work for loaded assets.

Here’s an example Playground https://playground.babylonjs.com/#MSA4PB#1

I’m sure I missed something really basic, but been stuck on this one.

P.s. I wonder if it’s related with this other post Scene.meshes is not returning proper array when glTF loaded to the scene - #6 by mawa

Thanks!

Your meshes have no children. So just set:

root.isPickable = true;

in your environment.meshes-loop.

It works, here PG:

2 Likes

Thanks, I was about to say the same when I quickly saw the post yesterday evening. But lazy me is just too tired to work after dinner time :shallow_pan_of_food: :grin: I prefered to watch a serie :zipper_mouth_face: :wink:

Edit: Actually, now that it is morning for me :coffee: :wink: let me just extend on this a little. @DiogoSnows : Say you actually wanted to be able to pick each single mesh in the scene, is it?
Then, you would just loop through all meshes and make them pickable, yes? Something like this:

Meanwhile, have a great day :sunglasses:

Edit 2: Forgot to mention that with this very simple version, if an object/mesh is in front of the selected mesh from this camera view, it will of course select the forefront mesh.

1 Like

Thanks! That solves it! Yes, I completely forgot to check the roots :man_facepalming: