Skip to content

Bug Fix: How to Fix EnhancedInput WASD Keyboard Input in Lyra 5.0 and 5.1 #15

@x157

Description

@x157

Problem: In Lyra and Third Person Template for UE 5.0+ the WASD keys on the keyboard to not work as expected. Pushing multiple keys in particular is broken. W+S keys should cancel out. A+D should cancel out. By default the examples Epic provides for IA_Move do not work this way and it feels broken.

Solution: for Keyboard Only, delete the keyboard IA_Move triggers, and add 4 different input actions IA_MoveForward, IA_MoveBackward, IA_MoveLeft, IA_MoveRight, which are mapped to your WASD keys instead of all 4 going to IA_Move.

With such a setup, pushing all 4 keys simultaneously will result in zero movement.

NOTE: I believe Epic may be looking to fix this, possibly as early as 5.2. If you need to fix this yourself in 5.1 or 5.2, here is the procedure:

Input Mapping Context:

image

Input Action Map:

image

Make sure for each one you copy, to copy the same settings as you see in IA_Move for this key.

image

Also copy the settings for the "player mappable" slot:

image

I just sent all of the new input tags to the same function that is handling IA_Move. In Lyra it's called Input_Move.

(In vanilla Lyra you'll want to edit ULyraHeroComponent::InitializePlayerInput. I derived a custom UXCLPlayerInputComponent based on ULyraHeroComponent).

image

For details on the LyraGameplayTags hacks made, see this comment (below) courtesy of @WhyAreLess

Also note: The above screenshot was using Lyra 5.1 style tags. After updating to Lyra 5.2 style Tags, the code looks slightly different, but the fix is essentially the same.

Files changed for fix:

image

I know, I know... I shouldn't hack LyraGameplayTags.cpp... I know. 🤣

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug fixHow to fix a bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions