BABYLON.ActionManager.OnPickTrigger do not work when I use custom mesh

I use a .gltf mesh and load it with sceneloader.
I loaded it and add a BABYLON.ActionManager.OnPickTrigger to it. when I add it to a box, it works, but when I add it to my custom mesh, it do not work. why?
code here:

const importPromise  = BABYLON.SceneLoader.ImportMeshAsync("", "./assets/models/", "scene.gltf");

    importPromise.then((result) => {

        var mesh = result.meshes[0];

        mesh.actionManager = new BABYLON.ActionManager(scene);

        mesh.actionManager.registerAction(

            new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,

                function (evt) {

            const sourceMesh = evt.meshUnderPointer;

            sourceMesh.scaling = new BABYLON.Vector3(2, 2, 2);

                }));

            });

You’re adding the behavior to the root node that Babylon adds when loading gltf models. Try adding the behavior to result.meshes[1], which will be the actual mesh that you’re loading.

1 Like

Hello @shibi just checking in, was your question answered?