카메라 Pitch, Yaw 매핑
void ACollider::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &ACollider::MoveForward);
PlayerInputComponent->BindAxis(TEXT("MoveRight"), this, &ACollider::MoveRight);
PlayerInputComponent->BindAxis(TEXT("CameraPitch"), this, &ACollider::PitchCamera);
PlayerInputComponent->BindAxis(TEXT("CameraYaw"), this, &ACollider::YawCamera);
}
void ACollider::PitchCamera(float input)
{
CameraInput.Y = input;
}
void ACollider::YawCamera(float input)
{
CameraInput.X = input;
}
void ACollider::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator NewRotation = GetActorRotation();
NewRotation.Yaw += CameraInput.X;
SetActorRotation(NewRotation);
FRotator NewSpringArmRotation = SpringArm->GetComponentRotation();
NewSpringArmRotation.Pitch += CameraInput.Y;
SpringArm->SetWorldRotation(NewSpringArmRotation);
}