Two key presses/combo with new Input Action feature

Trying to figure out the new Input Action feature. It’s actually pretty great but I can’t wrap my head around having the user press two buttons at the same time to count as an action.

I’ve tried assigning both shoulder presses but this feels wrong. Pretty sure UE will read this as either or not that both of them have to be pressed at the same time.

1 Like

Exploring the Input system myself so figured I’d take a crack at this! You need to make use of the Combo trigger.

(1) Create N + 1 input actions, where N is the number of buttons that need to be pressed. For example, I created IA_ComboLeft and IA_ComboRight for my two buttons, and IA_Combo to represent the ‘combination’ of both. These don’t need any special properties, they can all be standard input actions like any other button.

image

(2) In your Input Mapping Context, add your individual combo buttons (ComboLeft and ComboRight) like normal, and specify a key for each.

(3) Add your third Combo (representing both at the same time or quickly following each other) input action to the IMC, then drill down in the properties to Triggers. Add a new Combo trigger. In the Combo Actions, add the N buttons you want to press at the same time. Here you can also specify how much time they have to press the keys if you want to, but if you want it to be ‘instant’ (they MUST be pressed at the same time) you can’t set it to 0.0, do like 0.1 or something - experiment with it. Note: the order in which they’re added is the order in which they need to be pressed. Also, this should grey out the input key selection for your Combo.

(4) In your blueprint for IA_Combo, test for Completed, not Started. Testing for Started will fire when the first button in the combo list is pressed, which could be useful.

12 Likes

If you want order to not matter, you can use the “Chorded Action” trigger instead.

4 Likes