Hello. I am starting with UE4. As with Unity the first thing I decided to learn was setting up a character controller. I went as far as integrating the Animation Essentials without any problems, but have been stuck on implementing Aim Offset for 2 days without any indication of what is wrong.
I followed the “How to” from the docs exactly, yet nothing works. In fact changing the Yaw and Pitch (Or AimX and AimY how I called them, since aerodynamic terminology is confusing to me) in the blueprint editor in the preview settings does absolutely nothing to the pose either.
The only difference between the tutorial in the documentation and my project was that I set up the actual Player Character myself using C++ code, instead of using a premade Character from the Animation Essentials pack.
The code I have is really basic:
//...begin play, tick, blabla
// Called to bind functionality to input
void APlayerCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
check(InputComponent);
InputComponent->BindAxis("Forward", this, &APlayerCharacter::MoveForward);
InputComponent->BindAxis("Strafe", this, &APlayerCharacter::MoveRight);
InputComponent->BindAxis("AimX", this, &APlayerCharacter::AimX);
InputComponent->BindAxis("AimY", this, &APlayerCharacter::AimY);
}
void APlayerCharacter::setMouseSensitivity(float s) {
if (s<50.f)
mouseSensitivity = 50.f;
else if (s > 350.f)
mouseSensitivity = 350.f;
else
mouseSensitivity = s;
}
void APlayerCharacter::MoveForward(float amount) {
if (Controller && amount) {
FVector fwd = GetActorForwardVector();
AddMovementInput(fwd, amount);
}
}
void APlayerCharacter::MoveRight(float amount) {
if (Controller && amount) {
FVector right = GetActorRightVector();
AddMovementInput(right, amount);
}
}
void APlayerCharacter::AimX(float amount) {
AddControllerYawInput(mouseSensitivity*amount*GetWorld()->GetDeltaSeconds());
}
void APlayerCharacter::AimY(float amount) {
AddControllerPitchInput(mouseSensitivity*amount*GetWorld()->GetDeltaSeconds());
}
I have also used a Camera boom in the character blueprint editor
Does anyone have any idea why the aimOffset doesn’t work? Does it have something to do with me setting the character up though C++?