Multiple objects using the action manager

I was wondering if there’s a way for multiple objects to use the same action manager for this rollover effect for example so code isn’t repeated.

https://www.babylonjs-playground.com/#YIU90M#92

Thank you for any help

I just wrapped your ActionManager in a function that will attach it to the “mesh” argument,
maybe not the best solution but it works: :sweat_smile:

https://www.babylonjs-playground.com/#YIU90M#93

UPDATE!:
For a more “cleaner” solution check this approach:

https://www.babylonjs-playground.com/#YIU90M#95

Here we use only one ActionManager,

  • we define two actions
  • register them to the ActionManger
  • we attach the ActionManager to the meshes

Hope that can help you :slightly_smiling_face:

3 Likes

That’s amazing, thank you very much for your help and the lesson

1 Like