Input Key Held

Hi all,

I’d like to use an axis direction input key to press and release once that will keep the axis direction key held until a new input key direction.

Can any help offer any help?

Many thanks

What if I press and hold Up & Left simultaneously? Are we moving North-West?

Providing you’re not interested in inter-cardinals directions:

It might be close to what you need.

Thanks for responding Everynone. I’m using a thumb stick’s input for axis directions. I’m afraid, i wasn’t able to find the same vector node you’ve used?

It’s a new variable that you add yourself. I’ll post an example with axis later on, but the principle is the same. Do you also want to account for scale value? Since it’s a thumbstick, it’s a 0-1 range for each direction.

So in the end we’re not pressing / releasing, we’re just pushing controller thumbstick around.

For gamepad’s thumbstick axis:

This accounts for the axis scale - values lower than 1 are allowed. Other than that, you’d need to include more details regarding the desired behaviour.

Thanks. So, the compare float is used to set the vector direction. I was wondering why the X Axis value was connected to the Y direction and also if the Tick used to reset the direction to 0?

Axis events execute every frame, here Compare Float ensures they don’t execute when sticks are idle. Otherwise, if you let go of the sticks, the Direction would reset to 0,0,0, and the player would stop.

I was wondering why the X Axis […]

In Unreal X is Forward, but the controller’s X is horizontal. Pushing the stick forward evokes Y… We need to flip it. The axes being mixed up is not really an Unreal thing, it’s a software thing. Different software uses different setups.

As a rule of thumb it’s better not to poke around the topic too much as many forums wars we fought and lost over this. :wink: And no one is really right or wrong here. If you try to use 3ds Max and UE4 at default settings, your head will spin, though.

Tick used to reset the direction to 0

It’s not, Tick is actually using the vector the inputs set. The sticks set the direction (unless idle) and Tick continues using said Direction to apply movement.

Many thanks! I really appreciate your help and advice :slight_smile: