Lyra 5.3 Enhanced Input: Remapping the Dash Key

First of all, I would like to make it known that I added an input trigger type called InputTriggerDoubleTap to InputTriggers.h and .cpp respectively. I used the following code:

// .h
UCLASS(NotBlueprintable, MinimalAPI, meta = (DisplayName = "Double Tap", NotInputConfigurable = "true"))
class UInputTriggerDoubleTap : public UInputTrigger
{
    GENERATED_BODY()
 
protected:
    virtual ETriggerState UpdateState_Implementation(const UEnhancedPlayerInput* PlayerInput, FInputActionValue ModifiedValue, float DeltaTime) override;
public:
 
    UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category = "Trigger Settings", meta = (DisplayThumbnail = "false"))
    float Delay = .5f;
 
private:
    float LastTappedTime = 0.f;
};
 
// .cpp
ETriggerState UInputTriggerDoubleTap::UpdateState_Implementation(const UEnhancedPlayerInput* PlayerInput,
                                                                 FInputActionValue ModifiedValue, float DeltaTime)
{
    if (IsActuated(ModifiedValue) && !IsActuated(LastValue))
    {
        const float CurrentTime = PlayerInput->GetOuterAPlayerController()->GetWorld()->GetRealTimeSeconds();
        if (CurrentTime - LastTappedTime < Delay)
        {
            LastTappedTime = 0;
            return ETriggerState::Triggered;
        }
        LastTappedTime = CurrentTime;
    }
    return ETriggerState::None;
}
 

That way I could use it in order to achieve what I want. And in order to do so, I pulled Enhanced Input and Common UI plugins from the Engine and copied them into my Project’s Plugin folder.

What is it that I am trying to achieve? Ultimately I want to use W,S,A,D with a double tap to dash in the tapped direction. As well as be able to move with W,S,A,D as it normally does.

So step one of being able to create a double tap trigger is done. (The C++ side).

Step two, Open IMC_Default change the trigger type for our IA_Ability_Dash to our new trigger type. (Basically instead of on it being pressed, it will trigger on being double tapped.)
Once you have changed it, Set Delay to 0.25 and Actuation Threshold to 0.125

Go to Shooter Gym
Run PIE to Test. It should work. For me it does. Now I have to double tap the shift key while moving in a direction to dash in that direction. Instead of just pressing it.

Now If I change the key from being ‘Space Bar’ to ‘W’ So that my key to Dash is the same as my Forward Movement Key…

In theory, I assumed that it would allow me to Press ‘W’ Twice and it would do the Dash Forward. But, It seems to not do anything when I test it.

I am assuming that it just isn’t being created because we already have an Input Action already mapped to that key.

So, My question is: how do I get Lyra to add both mapping contexts where ‘W’ as Pressed to IA_Move and ‘W’ as DoubleTapped to IA_Ability_Dash?

Note: I had it working back in 5.2 but now it doesn’t seem to be in the updated 5.3 version of Enhanced Input. :frowning: :cry:

Correction: It seems to be working, however the timing seems to be way off. If I press the keys super rapidly I can get it to do the Dash (sometimes). No matter what I set Delay and Actuation Threshold to, it still seems to only work sometimes when rapidly spamming keys. If someone can point me to a fix to this bug, I would appreciate it. Thanks.