Dear Friends at Epic,
What is this new odd behavior in most recent version of the Engine?
In third Person games, if the camera is facing straight down, the character can only move in the A and D key directions.
W and S do not cause character to move!
This never used to happen before, in the Beta or even earliest UE4 versions.
How do I fix this?
Where is this code occurring?
How come A and D keys work, but not W and S
#Repro
Start a new third person C++ project
go in game in PIE
aim the camera straight down
try to move in W and S directions
then try and move in A and D directions
I can only get character to move in A and D when I do this
#Fix
I got around this issue by writing this code:
void AVictoryPlayerCharacterBase::MoveForward(float Value)
{
/*
//Has the strange behavior of
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector Direction = FRotationMatrix(Rotation).GetUnitAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
*/
if ((Controller != NULL) && (Value != 0.0f))
{
const FRotator YawRotation(0, Controller->GetControlRotation().Yaw, 0);
AddMovementInput(YawRotation.Vector(), Value);
}
}
The commented out code is what comes with the starter 3rd person project
Result: Character now continues to move in all 4 key directions WASD, even when camera is facing straight down or up. Character movement never slows just because of camera pitch angle
#Needs to be Addressed
I think this needs to be addressed, as it feels like a bug that the player is only stopped from moving in W and S directions when camera is straight down, but can still move in A and D