Hello fellow game developers
When I press and hold a keyboard button to move Pawns their movement is stuttered.
To demostrate the issue I’ve configured the simple Axis Mapping for a “W” key that prints the input argument’s value:
void ASomePawn::MoveForward(float input) {
UE_LOG(LogTemp, Warning, TEXT("%f"), input);
}
void ASomePawn::SetupPlayerInputComponent(UInputComponent* c) {
Super::SetupPlayerInputComponent(c);
c->BindAxis(TEXT("MoveForward"), this, &ABird::MoveForward);
}
The Axis Mapping itself works fine. Here is the shortened log of input to MoveForward function calls while I press, holding down, and finally release the “W” key on my keyboard: 00000000000000011111111111111111101010010001000101001011010011011100000000000000
As you can see from the log, after I press the “W” key for ~0.4sec the input is consistently “1”, but then it starts jumping between “0” and “1” until I finally release the “W” key when it turns to all “0” again.
I conducted some investigation and here are my findings related to this stuttering.
The stuttering occurs:
- independently of whether I use deprecated or Enhanced input system;
- even if I simply create and play a new “3rd person template” project;
- in all play modes (PIE, new editor window, standalone game);
- with the default pawn too.
And there is no stuttering if:
- I click any other keyboard key while holding “W” before the stuttering starts, or even after it starts effectively eradicating the stuttering;
- I map to left mouse button instead of the “W” key;
- I use “W” to move default pawn in the editor;
- I use any other application or game on my system.
I found similar issues on the internet, but they didn’t help me to solve the issue:
I tried to fiddle with Windows keyboard input configurations but wasn’t able to solve the issue.
I even tried to apply a “Smooth” modifier for my Enhanced input Mapping, it didn’t help too.
My keyboard doesn’t seem to have any input timing configurations either. I suppose the issue really may be with the keyboard, but I cannot get my hands on another keyboard for now to test this. And even if the keyboard is a culprit, what will I say to a player owning such a keyboard who cannot enjoy my UE games?
So, does anyone have any ideas how to solve this? I would really like to get some advice on my issue. I’m working on Windows 10, UE5.1 if it helps in any way.
Best regards.