Персонаж не поворачивается с помощью мышки по оси pitch(горизонтально).С осью Yaw(вертикально) все нормально(код писал по книге "Изучение C++ создавая игры в UE4").Вот код Avatar.h -
Код:
#include "GameFramework/Character.h"
#include "Avatar.generated.h"
UCLASS()
class GOLDENEGG_API AAvatar : public ACharacter
{
GENERATED_BODY()
void MoveForward(float amount);
void MoveRight(float amount);
void Yaw(float amount);
void Pitch(float amount);
public:
// Sets default values for this character's properties
AAvatar();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};
Код Avatar.cpp -
Код:
// Called every frame
void AAvatar::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
// Called to bind functionality to input
void AAvatar::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
check(InputComponent);
InputComponent->BindAxis("Strafe", this, &AAvatar::MoveRight);
InputComponent->BindAxis("Forward", this, &AAvatar::MoveForward);
InputComponent->BindAxis("Yaw", this, &AAvatar::Yaw);
InputComponent->BindAxis("Pitch", this, &AAvatar::Pitch);
}
void AAvatar::MoveForward(float amount)
{
if (Controller && amount)
{
AddMovementInput(GetActorForwardVector(), amount);
}
}
void AAvatar::MoveRight(float amount)
{
if (Controller && amount)
{
AddMovementInput(GetActorRightVector(), amount);
}
}
void AAvatar::Yaw(float amount)
{
AddControllerYawInput(200.f* amount * GetWorld()->GetDeltaSeconds());
}
void AAvatar::Pitch(float amount)
{
AddControllerPitchInput(200.f* amount * GetWorld()->GetDeltaSeconds());
}
Что мне делать???