문제
Animation Blueprint 상태 값을 C++ AnimInstance 계층으로 이동/분리
왜 전환했나
AnimBP의 EventGraph에서 직접 MovementComponent, Velocity, Acceleration등을 계산했음
이럴 경우
- 같은 계산이 AnimBP마다 반복될 수 있다.
- Player, NPC, Security가 비슷한 상태 값을 각자 다르게 계산할 가능성이 있다.
- StateMachine은 애니메이션 분기에 집중해야 하는데, EventGraph가 캐릭터 상태 수집과 계산 로직까지 떠안게 된다.
- C++ 부모 클래스로 바꿨을 때 Blueprint 변수와 C++ 변수의 접근 권한이 충돌할 수 있다.
AnimInstance 계층
이번 작업에서 기준으로 잡은 구조는 다음과 같다.
classDiagram
class UAnimInstance
class UFTCharacterAnimInstance
class UFTPlayerAnimInstance
class UFTAIAnimInstance
class UFTNPCAnimInstance
class UFTSecurityAnimInstance
UAnimInstance <|-- UFTCharacterAnimInstance
UFTCharacterAnimInstance <|-- UFTPlayerAnimInstance
UFTCharacterAnimInstance <|-- UFTAIAnimInstance
UFTAIAnimInstance <|-- UFTNPCAnimInstance
UFTAIAnimInstance <|-- UFTSecurityAnimInstance
FTCharacterAnimInstance는 Player와 AI가 공통으로 쓸 수 있는 캐릭터 상태를 담당한다.FTPlayerAnimInstance는 Player 전용 상태를 담당한다.
데이터 책임 전환
가장 먼저 옮긴 값은 매 프레임 반복 계산되고, 여러 StateMachine / BlendSpace에서 참조될 가능성이 높은 값들을 제일 먼저 옮겼다.
IsFalling
IsCrouching
Can Strafe
Forward
Strafe
Channeling
...반응형
'TIL' 카테고리의 다른 글
| World Partition (0) | 2026.07.23 |
|---|---|
| In Place 작업 (0) | 2026.07.22 |
| UE Preload (0) | 2026.07.16 |
| LevelDataAssetGenerator 수정 (0) | 2026.07.15 |
| IK (0) | 2026.07.14 |