how to use enhanced input for press, hold release

I am attempting to set up enhanced input for my game to allow the following:

  1. Tap the E key and the player fires the weapon once.
  2. Tap and hold the E key to initiate automatic fire and cease when the key is released.

I am doing this in C++.

How can I make this happen with Enhanced Input?

Hi,

Hope you’re doing well.

  1. Simple make a BindAction as Trigged type, e.g.
    EnhancedInputComponent->BindAction(ShotAction, ETriggerEvent::Triggered, this, &AGameCharacter::Shot);

  2. In the mapping context make the final ajustment adding two triggers, pressed and hold.


    You can also set the Threshold to adjust the time response.

Hope that helps - take care!