45 degrees rotation in c++?

Hi . I tried to convert the TwinStickShooter game to code. I have following Functions to look up, down , right and left.

void AHeroCharacter::lookUp(float Value)
{
	if ((Controller != NULL) && (Value != 0.0f))
	{
		 FVector Direction(Value, 0, 0);
	
		FRotator Rotation = Direction.Rotation();

			AController* MyController = UGameplayStatics::GetPlayerController(this, 0);
			MyController->SetControlRotation(Rotation);
		

	}
}

void AHeroCharacter::LookRight(float Value)
{
	if ((Controller != NULL) && (Value != 0.0f))
	{
		FVector Direction(0, Value, 0);
		FRotator Rotation = Direction.Rotation();

		AController* MyController = UGameplayStatics::GetPlayerController(this, 0);
		MyController->SetControlRotation(Rotation);
		

	}
}

but my Chracter turns 90 degrees from up to right or left. in its blue print version when i press both up and left together the character turns 45 degrees . how can I fix it like its blue print version ?

The Forward and Up are both executing the same code in the Twin Stick Shooter tutorial:

In that code the Direction vector has both the Up and Right values in X and Y. But yours only has X or Y. So to make it act similarly you could save the LookUp and LookRight values in class member variables. And call a common code base for both.

class AHeroCharacter {
...
    float LookUpValue = 0.0f;
    float LookRightValue = 0.0f;
...
}

void AHeroCharacter::LookUp(float Value) {
    LookUpValue = Value;
    Look();
}

void AHeroCharacter::LookRight(float Value) {
    LookRightValue = Value;
    Look();
}

void AHeroCharacter::Look() {
	if ((Controller != NULL) && (LookUpValue + LookRightValue != 0.0f))
	{
		FVector Direction(LookUpValue, LookRightValue, 0);
		FRotator Rotation = Direction.Rotation();

		AController* MyController = UGameplayStatics::GetPlayerController(this, 0);
		MyController->SetControlRotation(Rotation);
	}
}

That method would match the blueprint. Personally I would implement it a different way. Every tick on the controller I would get the values, instead of responding to the event:

float up = InputComponent->GetAxisValue("LookUp");
float right = InputComponent->GetAxisValue("LookRight");
if (up + right != 0.0f) {
    FVector Direction(up, right, 0);
    FRotator Rotation = Direction.Rotation();
    SetControlRotation(Rotation(Rotation);
}