Input && BindAxis, C++

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.

Very strange, and you don’t get any warnings or hints in the output of Visual Studio when compiling the project? FYI the call to the Super function should always be the first action after a function gets called, so you should move line 11 to right after line 2

Nothing of the axis mapping is working with me for a custom character :S

did this get solved ???

It was old, I cannot remember exactly, but did you try to possess the input in your class?

found the solution
just had to uncheck use mouse for touch

1 Like