Limiting Input

Hi there! I’m trying to figure out how to make a physics based jumping system with the physics thruster. The only thing I am having trouble with is figuring out how to limit the input of an input action. When I hold the button down, the thruster keeps going. Is there a way for me to make sure that the input acts as a single press instead of being continually fired until I let go? I’ve attached a screenshot of the BP. Any help would be appreciated!

You can use DoOnce node.
Or you can make boolean, that is true by defult, and changes to false after one execution. Use it’s branch as soon as Pressed is being performed. And you can change the boolean value in Release exec.

1 Like

Hvala Bojane! I have tried both, but the problem is that when I keep holding the button it keeps firing the input. So, it doesn’t stop at one press or click or however you want to call it.

Never mind, I fixed it with a delay node. Thanks!

:smiley: NNČ :slight_smile:
Pressed only get executed when you press the button and will not get executed until you release and press again. Maybe you are mistaken it with axis? Axis has execution every frame.

You can try to add Print screen node and check how it works.
Here is small example I have done. This is by no menas, code you should use. Delay node must be avoided, but should give you a clear picture how this input works. Thrust Activated is false by default

Please don’t use delay. Create your own mechanism that applies thrust for small amout of time when input is received. Use timers to make sure they are paused when game is paused.

1 Like