How can I access/use Double pressed key

Working on a dash when you double press a direction key.

How can I track a keyinput to see a keypress or bind the action of double pressing a key?

Use Action Mapping, it let you detect diffrent button events including doubleclick

Here documentation for it:

Use commets to reply for anwsers :stuck_out_tongue:

If you want to use Axis i guess you will need to track axis whatever it pops twice and then use timer to measure distance between clicks.

GetWorldTimerManager().SetTimer(this, &ASomeClass::FunctionToCall, TimeInFloat);

or count based on adding DeltaTimes?
Set bool to true on first detection and then start counting time (or do settimer to function) and when times up set bool to false. If you detected another axis pop when bool is true it means you got double click ;]

Alternatively you can map single button action and axis in same time

Thanks but those work for keypress how would you track a doubletap on a joystick?

Should not it work as intended?

InputComponent->BindAction("Action", IE_DoubleClick, this, &UObject::Function);

Thats what i proposed to him but he wants double click on axis which does not have that feature

Hm indeed, sorry didn’t notice.

Sorry if you could expand on the timer or delta times setup I am not exactly sure how to implement these.
I know I can check for the movement in the axis but I am not sure how to start the timer and make it wait for the same action to happen again.

I will of course look at the API and see if I can drudge up more on timer usage.


Timer setup should be easier :slight_smile: you just make funtion that will be called when time will passed and you place pointer to that faction as 2nd argument of settimer in 3rd you place how much time need to be passed for funtion to be called.

But read api documantation anyway there also other funtions that controls the timer which you might find useful