unreal-engine5gamepadenhanced-input-system

Enhanced Input Ongoing Gamepad Stick Binding


My desired behavior is that the gamepad left stick 2d vector will send input every tick about its latest position.

Input Mapping Context

Input Action


Solution

  • I figured out the answer by creating a new First-Person Game with C++ (the default Unreal 5 template) and studying how they did Enhanced Input.

    The Input Mapping Context has no triggers or modifiers:

    Input Mapping Context

    The Input Action also has no triggers or modifiers:

    Input Action

    Here's how I bound the action in ShipCharacter.cpp

    void AShipCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
    {
        Super::SetupPlayerInputComponent(PlayerInputComponent);
    
        if (UEnhancedInputComponent* Input = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
        {
            Input->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AShipCharacter::InputMove);
        }
    }
    
    void AShipCharacter::InputMove(const FInputActionValue& Value)
    {
        const FVector2D V = Value.Get<FVector2D>();
        // todo stuff with the input
    }