Hello! Need help. I don’t undestand, why it is dont work.
I have class is AAvatar heir from ACharacter;
I have 4 BindAxis, but binding method is “Pitch(float)” dont calling, why?
String name “Pitch” equale in Input Settings.
void AAvatar::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
check(InputComponent);
InputComponent->BindAxis("Forward", this, &AAvatar::MoveForward);
InputComponent->BindAxis("Strafe", this, &AAvatar::MoveRight);
InputComponent->BindAxis("Yaw", this, &AAvatar::Yaw);
InputComponent->BindAxis("Pitch", this, &AAvatar::Pitch);
Super::SetupPlayerInputComponent(InputComponent);
}
void AAvatar::MoveForward(float amount)
{
if (Controller && amount)
{
FVector fwd = GetActorForwardVector();
AddMovementInput(fwd, amount);
}
}
void AAvatar::MoveRight(float amount)
{
if (Controller && amount)
{
FVector right = GetActorRightVector();
AddMovementInput(right, amount);
}
}
void AAvatar::Yaw(float amount)
{
AddControllerYawInput(200.f * amount * GetWorld()->GetDeltaSeconds());
}
void AAvatar::Pitch(float amount)
{
AddControllerPitchInput(200.f * amount * GetWorld()->GetDeltaSeconds());
}
Forward, Strafe and Yaw works. Thanks.