기초반 강의

기초반 5강 / 캐릭터 애니메이션 수정, 상태머신을 사용한 점프 구현

jh009 2026. 7. 11. 17:40

점프 상승/하강 값 + 점프 락아웃

UPlayerAnimInstance에 VerticalSpeed 추가

 

Public/Animation/PlayerAnimInstance.h

 

Public/Animation/PlayerAnimInstance.cpp

 

VDirectionSpeed의 V는 BlendSpace 세로축(Vertical axis = 앞뒤) 을 의미

위아래 = VerticalSpeed(= Velocity.Z)


점프 락아웃 - Landed 오버라이드

 

Characters/Player/PlayerCharacter.h

 

LastLandedTime 초기값이 -10.f 인 이유

  • 스폰 직후(게임 0초)에 0으로 두면 TimeSince가 0에 가까워 첫 점프가 막힐 수 있음
  • 과거 시각으로 깔아두면 첫 점프는 항상 통과
  • 이 값은 단순 float라 GC 추적이 필요 없어서 UPROPERTY 를 붙이지 않음

 

Characters/Player/PlayerCharacter.cpp

 

Landed 구현 + 기존 InputActionJump 교체


BlendSpace 생성

Content/Characters/Player/Animations/ 안에서 우클릭 → AnimationBlend Space

 

Skeleton 선택 창 → UE4_Mannequin_Skeleton 선택 → 이름설정 BS_Player_Move


축 설정 (Asset Details 좌측)

이름 Minimum Maximum
Horizontal Axis HSpeed -600 600
Vertical Axis VSpeed -600 600

 

위치 (H, V) 애니메이션
(0, 0) 중앙 Idle_Rifle_Hip
(0, 600) Jog_Fwd_Rifle
(0, -600) 아래 Jog_Bwd_Rifle
(-600, 0) 왼쪽 Jog_Lt_Rifle
(600, 0) 오른쪽 Jog_Rt_Rifle


ABP_Player에 상태머신 구축

State MachinesAdd New State Machine 선택 → 이름설정 Locomotion

 

상태 4개 + 진입(Entry)

Locomotion상태머신을 더블클릭 → 상태 4개를 추가(우클릭 → Add State)

상태 역할
Ground 지상 이동 — Idle/달리기 (BlendSpace)
JumpStart 점프 도약
JumpFalling 체공·낙하
JumpEnd 착지


Ground상태 - 이동 BlendSpace

Ground 상태 더블클릭

우측 Asset Browser에서 BS_Player_Move 드래그

 

BlendSpace 노드의 핀에 연결:

X (HSpeed) ← HDirectionSpeed

Y (VSpeed) ← VDirectionSpeed

 

출력 → Output Animation Pose


점프 3단 - 포즈 3개로 잘라 쓰기

External/AnimStarterPack → Jump_From_Stand 복제

 

복제 파일을 Player Animations 폴더로 Move로 이동 → Player Animations 폴더 Update Redirector References

 

http://content/Characters/Player/Animations/

 

Jump_From_Stand1 복제 후 이름 수정

새 시퀀스 쓸 구간 Loop
AS_Player_JumpStart 웅크렸다 솟구치는 앞부분(도약) ❌ 끔
AS_Player_JumpFalling 공중에 뜬 가운데(체공)
AS_Player_JumpEnd 발 닿고 무릎 펴는 뒷부분(착지) ❌ 끔

 

AS_Player_JumpStart

  • 16프레임 이후 내용을 삭제

 

AS_Player_JumpFalling

  • 16프레임 매우 짧은 프레임만 남기기
  • 16프레임 앞에서 자르고 16프레임 뒤에서 자름

 

AS_Player_JumpEnd

  • 18프레임 앞으로는 다 자르기


각 상태에 포즈 물리기

JumpStart / JumpFalling / JumpEnd 상태를 각각 더블클릭

→ Sequence Player 노드 → 방금 만든 클립 연결 → Output Animation Pose


전환 규칙

전환 조건
Ground → JumpStart bIsFalling == true AND VerticalSpeed > 0
JumpStart → JumpFalling VerticalSpeed < 0
JumpFalling → JumpEnd bIsFalling == false
JumpEnd → Ground 자동 룰 (Automatic Rule Based on Time Remaining)

 

1. Ground → JumpStart

 

2. JumpStart → JumpFalling

 

3. JumpFalling → JumpEnd

 

4. JumpEnd → Ground


폴더 정리

캐릭터 파일 정리

Content/Characters/Player/Animations/Montages 파일 생성

 

몬스터도 마찬가지로 정리

Content/Characters/Monsters/Animations/Montages 파일 생성

 

Content/Characters/Player/Animations/Sequences 파일생성

 

Weapons → Data