Mesh click Event not work

I simlply load glb file and add action using by action manager but it didn’t work

		let bot: any;
		const result = SceneLoader.ImportMeshAsync(null, "/glb/", "bot_box.glb", scene).then((result) => {
			bot = result.meshes[0];
			bot.isPickable = true;
			bot.position.z = -1;
			bot.position.y = -2;

			bot.actionManager = new BABYLON.ActionManager(scene);
			// Add a pointer down action to the action manager
			bot.actionManager.registerAction(new BABYLON.ExecuteCodeAction(
				BABYLON.ActionManager.OnPickTrigger,
				() => {
					console.log("click");
				}
			));
		});

I succefully loaded box mesh but I can’t see the any log even I click the mesh correctly

meshes[0] is not a real mesh, it is a node called “root”. Maybe you should just change it to meshes[1]

3 Likes