티스토리 뷰
🟩 오늘의 목표
- Git을 활용하여 팀원 간 에셋을 공유하고 프로젝트를 동기화하는 워크플로우를 숙달한다.
- PlayerController(플레이어 컨트롤러)의 역할을 이해하고 Enhanced Input 시스템을 구축한다.
- IA(입력 액션)와 IMC(입력 매핑 컨텍스트)를 설정하여 캐릭터의 이동, 점프, 회전, 스프린트 로직을 완성한다.
🟧 1. Git 특강: 효율적인 에셋 공유 및 협업 프로세스
팀 프로젝트에서 에셋 누락 없이 환경을 맞추기 위한 Git Master와 팀원의 역할을 정리했다.
🟦 Git Master의 역할
- 공유할 에셋을 프로젝트 Content(콘텐츠) 폴더에 모으고 Push 한다.
- git clean -fx -d 명령어로 불필요한 파일을 정리한 후 프로젝트를 압축하여 팀원에게 배포한다.
- 새로운 에셋 추가 시 프로젝트 내 .git 폴더와 새로운 Content 폴더를 다시 압축하여 배포한다.
🟦 팀원의 역할
- 배포받은 파일을 압축 해제하고 Generate Visual Studio project files를 실행하여 환경을 구축한다.
- 솔루션 재빌드 후 에디터를 실행하여 정상 작동을 확인한다.
- 추가 배포된 파일은 기존 프로젝트 폴더에 덮어쓰기 하여 Git Desktop(깃 데스크탑) History에 에셋 내역이 뜨는지 확인한다.
🟧 2. Enhanced Input System 활용 매핑 구현
사용자의 입력을 해석하여 캐릭터에게 명령을 내리는 구조를 설계했다.
🟦 PlayerController(플레이어 컨트롤러)
입력 신호를 받아 Pawn에게 명령을 내리는 컨트롤 타워다. APlayerController를 상속받은 C++ 클래스를 생성하고 이를GameMode(게임 모드)에 등록하여 사용한다.
ASpartaGameMode::ASpartaGameMode()
{
DefaultPawnClass = ASpartaCharacter::StaticClass();
// 커스텀 플레이어 컨트롤러 등록
PlayerControllerClass = ASpartaPlayerController::StaticClass();
}
🟦 IA(입력 액션) 및 IMC(입력 매핑 컨텍스트) 설정
- IA(입력 액션): 이동(IA_Move), 점프(IA_Jump) 등 동작을 추상화한다. 이동과 회전은 Axis2D(2차원 축) 값을 사용하여 상하좌우 입력을 동시에 처리한다.
- IMC(입력 매핑 컨텍스트): IA와 실제 키보드/마우스 버튼을 매핑한다. **Negate(반전)**와 Swizzle(축 전환) 모디파이어를 사용하여 W, S, A, D 키에 적절한 축 값을 부여한다.
🟧 3. 캐릭터 동작 구현과 입력 처리
SetupPlayerInputComponent(입력 컴포넌트 설정) 함수를 통해 IA와 실제 C++ 함수를 바인딩했다.
🟦 입력 바인딩 로직
BindAction(액션 바인딩) 함수를 사용해 특정 이벤트(Triggered, Completed 등)가 발생할 때 실행될 함수를 연결한다.
void ASpartaCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
if (UEnhancedInputComponent* EnhancedInput = Cast<UEnhancedInputComponent>(PlayerInputComponent))
{
if (ASpartaPlayerController* PlayerController = Cast<ASpartaPlayerController>(GetController()))
{
// 이동 바인딩
EnhancedInput->BindAction(PlayerController->MoveAction, ETriggerEvent::Triggered, this, &ASpartaCharacter::Move);
// 점프 바인딩 (누를 때 시작, 뗄 때 중단)
EnhancedInput->BindAction(PlayerController->JumpAction, ETriggerEvent::Triggered, this, &ASpartaCharacter::StartJump);
EnhancedInput->BindAction(PlayerController->JumpAction, ETriggerEvent::Completed, this, &ASpartaCharacter::StopJump);
}
}
}
🟦 캐릭터 이동 및 시점 회전 함수
AddMovementInput(이동 입력 추가)과 AddControllerYaw/PitchInput을 사용하여 실제 움직임을 구현한다.
void ASpartaCharacter::Move(const FInputActionValue& value)
{
if (!Controller) return;
const FVector2D MoveInput = value.Get<FVector2D>();
// 앞뒤(X), 좌우(Y) 이동
AddMovementInput(GetActorForwardVector(), MoveInput.X);
AddMovementInput(GetActorRightVector(), MoveInput.Y);
}
void ASpartaCharacter::Look(const FInputActionValue& value)
{
FVector2D LookInput = value.Get<FVector2D>();
// 마우스 이동에 따른 시점 회전
AddControllerYawInput(LookInput.X);
AddControllerPitchInput(LookInput.Y);
}
🟦 스프린트(달리기) 기능 구현
CharacterMovementComponent(캐릭터 무브먼트 컴포넌트)의 MaxWalkSpeed(최대 걷기 속도) 속성을 실시간으로 변경하여 달리기 기능을 구현했다.
void ASpartaCharacter::StartSprint(const FInputActionValue& value)
{
// 스프린트 속도로 변경 (기본 600 -> 900)
if (GetCharacterMovement())
{
GetCharacterMovement()->MaxWalkSpeed = SprintSpeed;
}
}
void ASpartaCharacter::StopSprint(const FInputActionValue& value)
{
// 기본 속도로 복귀
if (GetCharacterMovement())
{
GetCharacterMovement()->MaxWalkSpeed = NormalSpeed;
}
}
🟫 오늘 느낀 점
Git을 이용한 에셋 공유 방식을 익혀 팀 협업의 효율성을 높였으며, Enhanced Input 시스템을 통해 입력과 동작을 분리하는 구조를 이해했다. 복잡해 보였던 캐릭터 이동과 스프린트 로직을 직접 코딩하며 언리얼 엔진의 강력한 무브먼트 컴포넌트 기능을 체감했다.
'내일배움캠프 Unreal_7기 > 본캠프' 카테고리의 다른 글
| TIL - 35일차 (1) | 2026.01.16 |
|---|---|
| TIL - 34일차 (0) | 2026.01.15 |
| TIL - 32일차 (0) | 2026.01.13 |
| TIL - 31일차 (1) | 2026.01.12 |
| TIL - 30일차 (0) | 2026.01.09 |

