Play animation when key is pressed

Need script that makes it so i can click a key to play an animation

Hello @Orange_Test_Room,

You can take a look in this tutorial: https://developer.playcanvas.com/en/tutorials/animation-blending/

When pressing the key P the animation will change. You can do something similar to start the animation on key press.

stop telling me to lloo at the tutorials i dont understand it can someone just make the script

I’ve observed that when you put forth an effort of you own, more people are willing to put forth extra effort to assist you. Do as you like, but that has worked fairly well for me on this forum.

5 Likes

its called being lazy

If you just did a little reading, you would be able to understand. It’s not that hard to click a few links and buttons to get to the script.

1 Like

wut

Im saying to just use the link to the tutorial

i tried that it didnt work the also im not sure if the script works for 2d wich im using

If you’re using 2D, you have to switch using the sprite component. Animation blending is for 3D animations.

@Orange_Test_Room, to add to what @DevPlex01 said, check out the following guide on animated sprites - https://developer.playcanvas.com/en/user-manual/packs/components/sprite/#animated-sprites.

If it still continues to not work, you can post the code you tried with, and then the community can help you out better.

Hope this helps!

seen it ive done exactly what should be riight but i have an idea