Hello Community,
I am programming a simple top down shooter in C++ using the Unreal Engine.
Everyting is working as expected and perfectly, except for one thing:
I am using a Player Controller to move the Pawn throw the World. The Problem is that when i press A (Walk Left) and W (walk forward) at the same time my charackter is way faster than just pressing a single Button.
// Input for Forward and Backward
void APlayerCharackterController::MoveForwardAndBackward(float Value)
{
if (Value != 0.0f)
{
APawn* const PlayerCharackterPawn = GetPawn();
PlayerCharackterPawn->AddMovementInput(GetActorForwardVector(), Value);
}
}
// Input for Right and Left
void APlayerCharackterController::MoveRightAndLeft(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
APawn* const PlayerCharackterPawn = GetPawn();
PlayerCharackterPawn->AddMovementInput(GetActorRightVector(), Value);
}
}
So, I am pretty sure why this problem is there, but I have no Idea how I can solve this problem. I thought about normalizing a Vector, but, as I alredy said, i have no Solution to this problem.
I just want to move the Pawn in the same speed when i press one or two buttons.
Thank you in advance for yout help
ps: sorry for my bad english