include “camera/CameraPawnBase.h”
ACameraPawnBase::ACameraPawnBase()
{
PrimaryActorTick.bCanEverTick = true;
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
RootComponent = CameraBoom;
CameraBoom->TargetArmLength = 750.0f; // Distance from camera to pawn
CameraBoom->bUsePawnControlRotation = true; // Rotate arm based on controller
CameraBoom->bDoCollisionTest = false; // Disable collision test for SpringArm
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->SetupAttachment(CameraBoom);
bUseControllerRotationPitch = false;
bUseControllerRotationRoll = false;
bUseControllerRotationYaw = false;
FieldOfView = 90.0f;
AspectRatio = 16.0f / 9.0f;
PostProcessBlendWeight = 0.0f;
}
void ACameraPawnBase::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
void ACameraPawnBase::BeginPlay()
{
Super::BeginPlay();
APlayerController* PlayerController = Cast<APlayerController>(GetController());
if (PlayerController)
{
this->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
}
}
void ACameraPawnBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}