Picking custom mesh with actionManager in React Native


I’m trying to pick a custom mesh that I’ve exported from Blender, but it doesn’t seem to work. I can pick a box or sphere that I’ve created with the MeshBuilder, but the same events don’t trigger for meshes that I’ve imported through SceneLoader.LoadAssetContainer.
Maybe it’s because the custom mesh can contain multiple meshes?
I create a rootmesh for it (through container.createRootMesh() and then I call container.addAllToScene()).

I was hoping the picking would also be triggered for children of the mesh. Is that correct? Is there something else I can do to make it work?


It should work normally: Pick mesh | Babylon.js Playground (babylonjs.com)

Can you provide us with a playground of your scene and mesh so we can take a look at what you’re doing?

1 Like


Thanks for that example, I’m trying to use the actionmanager on the mesh instead of on the scene as a whole. But after making the react native example for it, I found out my implementation also doesn’t work in the playground. Do you maybe see what I did wrong here?


The “mesh” you use is the “pseudo”-mesh (root) of gltf/glb, which is an empty mesh without vertices to pick. You have to create action manager (+registered actions) for all the children (submeshes) of the root mesh. Or you merge them by MergeMeshes, but this won’t work with animations.


Ah, I see. Thanks for explaining that! I thought it would maybe go down the tree of meshes with the picking but I guess not.