With Unreal Engine 4, I followed multiple tutorials that configured basic movement input in C++ like this:
void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &APlayerCharacter::MoveForward);
PlayerInputComponent->BindAxis(TEXT("MoveRight"), this, &APlayerCharacter::MoveRight);
}
void APlayerCharacter::MoveForward(float AxisValue)
{
AddMovementInput(GetActorForwardVector() * AxisValue);
}
void APlayerCharacter::MoveRight(float AxisValue)
{
AddMovementInput(GetActorRightVector() * AxisValue);
}
Along with this input configutation:
And it would work as expected. MoveForward would move the pawn forwards and backwards, MoveRight would strafe the character left and right.
Now, when I use these exact same lines of C++ code in Unreal Engine 5.1, and exact same input configuration in the project settings, the pawn/player character no longer strafes left and right. He spins around in circles endlessly.
What gives?