[SOLVED] Object A: Play Animation when clicked on Object B

I have a hard time trying to learn to code with javascript in playcanvas.

What I am trying to achieve is that when I click on object A. I want to have object B play an animation.
They are both 3d objects. I managed to have raycast working. But now I need to know how to send the event to object B and play an animation.

I hope someone can help me with this.

Hi @Maarten_deVries! I don’t know the set up of your project, but maybe you can use something like below?

this.app.root.findByName("ObjectB").animation.play(animation, 0.2);
1 Like

thank you it works!

1 Like