Open x157 opened 1 year ago
For anyone having their character(s) stuck, don't forget to add the gameplay tags to the LyraGameplayTags.h
and LyraGameplayTags.cpp aswell.
Changed this to Bug Fix as I believe Epic will fix this hopefully in 5.2. Thus no how to fix tutorial will be needed after 5.2.
fyi for those who come here in general, not only for Lyra. 5.2's code still has the same "bug". I believe this is intentional and one isn't supposed to use 1 InputAction_Move for WASD (it does work for 1 Left Thumbstick Axis of a Gamepad though, just not for 4 keys WASD). So the bug is basically in Lyra not in UE.
Thanks @eXifreXi. I agree, I think the C++ EI implementation is designed to work that way and isn't bugged.
What is bugged is just the input configs used in Lyra (and the 3rd person template, and perhaps also other samples/templates/etc). Still bugged in 5.2, as you say. Fingers crossed they fix the configs for 5.3!
In UE5.2, the Enhanced Input keyboard input still doesn't allow two opposite axes to cancel each other out. And I've tried your method, it's quite strange that if I hold down the WS keys first and then hold down the AD keys, the character can stop properly. But if I press the AD keys first and then press the WS keys, the character will move forward or backward (depending on whether W or S was pressed first).
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 forIA_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 actionsIA_MoveForward
,IA_MoveBackward
,IA_MoveLeft
,IA_MoveRight
, which are mapped to your WASD keys instead of all 4 going toIA_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:
Input Action Map:
Make sure for each one you copy, to copy the same settings as you see in
IA_Move
for this key.Also copy the settings for the "player mappable" slot:
I just sent all of the new input tags to the same function that is handling
IA_Move
. In Lyra it's calledInput_Move
.(In vanilla Lyra you'll want to edit
ULyraHeroComponent
::InitializePlayerInput
. I derived a customUXCLPlayerInputComponent
based onULyraHeroComponent
).For details on the
LyraGameplayTags
hacks made, see this comment (below) courtesy of @WhyAreLessAlso 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:
I know, I know... I shouldn't hack
LyraGameplayTags.cpp
... I know. 🤣