오늘 작업 내용
1. Box Component 생성 및 설정
- BoxComponent를 생성하고 루트 컴포넌트(Root Component)로 설정.
- 기존 캐릭터의 CapsuleComponent와 유사한 역할을 수행.
- 루트 컴포넌트 설정 이유: Pawn의 기본 충돌 영역을 정의.
#include "Components/BoxComponent.h"
ASpartaPawn::ASpartaPawn()
{
BoxComp = CreateDefaultSubobject<UBoxComponent>(TEXT("Box")); //박스 컴포넌트 생성
RootComponent = BoxComp; //박스 컴포넌트 루트 설정
}
2. Skeletal Mesh Component 추가
- 캐릭터 외형을 표시할 Skeletal Mesh Component 생성 및 부모 컴포넌트(Box)와 연결.
ASpartaPawn::ASpartaPawn()
{
SkeletalMeshComp = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("SkeletalMesh")); //스켈레탈 메쉬 생성
SkeletalMeshComp->SetupAttachment(BoxComp);
}
3. Spring Arm & Camera Component 추가
- 루트 컴포넌트(Box) 하위에 Spring Arm, 그리고 Spring Arm 하위로 Camera Component를 추가하였다.
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
ASpartaPawn::ASpartaPawn()
{
SpringArmComp = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
SpringArmComp->SetupAttachment(RootComponent);
SpringArmComp->TargetArmLength = 300.0f;
SpringArmComp->bUsePawnControlRotation = true;
CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
CameraComp->SetupAttachment(SpringArmComp, USpringArmComponent::SocketName);
CameraComp->bUsePawnControlRotation = true;
}
4. Enhanced Input System 구성
- Input Action 및 Input Mapping Context 생성.
- Player Controller에서 입력 데이터를 처리하도록 설정.
- 현재 구현된 Action:
- Move: 캐릭터 이동.(SetActorLocation() 사용)
- Sprint: 달리기.
Character 클래스에 이미 구현된 기능들을 커스텀하거나 하나씩 구현해보려니 쉽지 않았습니다.. 😭
내일은 시선 처리 기능인 Look, Jump 등을 구현해볼 예정
'TIL > C++와 UE' 카테고리의 다른 글
회전 관련 함수 및 Pawn 클래스 Look 함수 (1) | 2025.01.27 |
---|---|
충돌 검사 (0) | 2025.01.24 |
언리얼 엔진 클래스 계층 구조 (0) | 2025.01.22 |
액터 Transform을 위한 좌표계와 부동 소수점 연산 (0) | 2025.01.21 |
언리얼 엔진 C++ 빌드 프로세스 (0) | 2025.01.20 |