My first very basic script, scratching my noggin still


I want to rotate the cube when I press A. I managed to do it, but it only rotated once and only each time i tap the A key. I wanted it so if I held down A that the cube would continue rotating. This picture shows my current setup, and when I hit play the cube is spinning without pressing or holding the A key.

I’m really new at all this, I’m having a lot of fun already, and I just want to see if someone could point me in the right direction. I don’t necessarily want the answer straight up, I’d like to try figure it out. But right now I’m not sure what’s going wrong!

At first, don’t execute the same nodes in 2 different custom events (in this case the A and the EventTick event). There is generally nothing wrong about it but a beginner then does possibly understand how the nodes work wrongly.

2 easy possibilities there to solve your problem:

  1. In the A pressed event you set a new boolean variable to true, let’s call it AisPressed. And in the A released event you set AisPressed to false. In EventTick you start with a Branch node. In the condition input you plug AisPressed. In the True output of the Branch you plug your AddActorLocalRotation node.

  2. Instead of creating an InputAction event for the key A you could create an InputAxis event for the key A. Not sure if this is directly doable in a blueprint or only under Edit->Project Settings->Input. Btw, this the location you should bind your keys anyway but that’s another thing. Then you don’t need your EventTick event. InputAxis events fire frequently and not only once the key is pressed/released.

@Pepeeee I got it to work, I used your method 1 because that just sounded nicest to me and I understood it! It worked exactly as I was hoping! this is a cool feeling. thanks for your guidance!