Geometry Collection
Chaos Destruction의 핵심 에셋과 Clustering 시스템
Geometry Collection 개요
실시간 파괴의 기본 에셋
Geometry Collection은 Chaos Destruction 시스템에서 파괴 가능한 메시를 표현하는 에셋입니다. Static Mesh를 Fracture(분할)하여 생성하며, 내부적으로 계층적 클러스터 구조를 가집니다.
UE4의 APEX Destruction은 UE5에서 완전히 제거되었습니다. 모든 파괴 시스템은 Chaos Destruction + Geometry Collection으로 대체되었습니다. Destructible Mesh 에셋은 더 이상 지원되지 않습니다.
- UGeometryCollection — 파괴 조각(Geometry) 데이터를 담는 에셋. Fracture 결과물이 저장됩니다.
- AGeometryCollectionActor — Geometry Collection을 월드에 배치하는 액터.
- UGeometryCollectionComponent — 렌더링과 물리 시뮬레이션을 담당하는 컴포넌트.
- Bone Hierarchy — 각 파편은 "bone"으로 표현되며, 클러스터 계층을 형성합니다.
// Geometry Collection 액터에서 컴포넌트 접근
AGeometryCollectionActor* GCActor = /* 월드에 배치된 액터 */;
UGeometryCollectionComponent* GCComp = GCActor->GetGeometryCollectionComponent();
// 시뮬레이션 상태 확인
bool bSimulating = GCComp->GetIsObjectDynamic();
// Rest Collection (에셋) 접근
const UGeometryCollection* GC = GCComp->GetRestCollection();
if (GC)
{
int32 NumGeometries = GC->GetGeometryCollection()->NumElements(
FGeometryCollection::TransformGroup
);
UE_LOG(LogTemp, Log, TEXT("Total bones: %d"), NumGeometries);
}
Geometry Collection 생성 워크플로우
Static Mesh에서 파괴 가능 에셋까지
- 1단계 — Static Mesh를 Content Browser에서 우클릭 →
Create Geometry Collection선택. - 2단계 — 생성된 Geometry Collection을 더블클릭하여 Fracture Mode 에디터 진입.
- 3단계 — Fracture 도구(Uniform, Radial, Clustered 등)로 메시를 파편으로 분할.
- 4단계 — Auto Cluster로 파편을 계층적 클러스터로 그룹화.
- 5단계 — 파편별 물리 속성(Damage Threshold, Anchored 등) 설정.
- 6단계 — 레벨에 GeometryCollectionActor로 배치.
Fracture Mode 에디터에서 여러 Static Mesh를 하나의 Geometry Collection에 추가할 수 있습니다. 이를 통해 벽, 기둥, 바닥 등 복합 구조물을 하나의 파괴 시스템으로 관리할 수 있습니다.
Clustering 시스템
계층적 파괴의 핵심
Clustering은 파편을 계층적으로 그룹화하여, 약한 충격에는 큰 덩어리로, 강한 충격에는 개별 파편으로 부서지도록 하는 시스템입니다. 현실적인 파괴 연출의 핵심입니다.
| 클러스터 레벨 | 동작 | 설명 |
|---|---|---|
| Level 0 (Root) | 초기 상태 | 전체 메시가 하나의 단위로 동작 |
| Level 1 (Cluster) | 1차 파괴 | 큰 덩어리로 분리 (청크) |
| Level 2+ (Leaf) | 세밀한 파괴 | 개별 파편으로 분리 |
// Geometry Collection Component의 파괴 설정
void ADestructibleWall::SetupDestruction()
{
UGeometryCollectionComponent* GCComp = GetGeometryCollectionComponent();
// Damage Threshold: 이 값 이상의 힘이 가해져야 파괴
GCComp->DamageThreshold = {500.0f}; // 클러스터 레벨별 설정 가능
// Enable Damage: 데미지 시스템 활성화
GCComp->bEnableDamageFromCollision = true;
// Cluster Connection Type
// - Pointwise: 인접한 파편 끼리만 연결
// - DelaunayTriangulation: 들로네 삼각분할로 연결
// - BoundsOverlapFilteredDelaunay: 범위 기반 필터링
// 초기 상태 설정
// Anchored: 고정 (바닥에 붙어있는 벽 등)
// Kinematic: 움직이지만 물리 시뮬레이션 안 받음
// Dynamic: 즉시 물리 시뮬레이션
}
개별 bone의 Initial Dynamic State를 설정할 수 있습니다. Anchored는 바닥/벽에 고정된 상태로, 주변 파편이 떨어져 나가도 고정을 유지합니다. 건물 벽의 기초 부분 등에 유용합니다.
런타임 파괴 제어
C++에서 파괴 트리거 및 이벤트 처리
// 외부에서 Geometry Collection에 데미지 적용
void ADestructibleWall::ApplyDestructionForce(FVector Location, float Force)
{
UGeometryCollectionComponent* GCComp = GetGeometryCollectionComponent();
// 방법 1: 내부 Strain 적용 (권장)
GCComp->ApplyExternalStrain(
0, // TransformIndex (bone index)
Location,
100.0f, // Radius
0, // PropagationDepth
0.5f, // PropagationFactor
Force // Strain
);
// 방법 2: 물리 임펄스로 간접 파괴
GCComp->AddImpulseAtLocation(
GetActorForwardVector() * Force,
Location
);
}
// 파괴 이벤트 수신
void ADestructibleWall::BeginPlay()
{
Super::BeginPlay();
UGeometryCollectionComponent* GCComp = GetGeometryCollectionComponent();
// Breaking 이벤트: 파편이 분리될 때
GCComp->OnChaosBreakEvent.AddDynamic(
this, &ADestructibleWall::OnBreaking
);
// Removal 이벤트: 파편이 제거될 때
GCComp->OnChaosRemovalEvent.AddDynamic(
this, &ADestructibleWall::OnRemoval
);
}
void ADestructibleWall::OnBreaking(const FChaosBreakEvent& BreakEvent)
{
// BreakEvent.Location: 파괴 위치
// BreakEvent.Velocity: 파편 속도
// BreakEvent.Mass: 파편 질량
UGameplayStatics::SpawnEmitterAtLocation(
GetWorld(), BreakFX, BreakEvent.Location
);
}
Geometry Collection Component의 Removal 설정에서 파편의 최대 수명, 최대 클러스터 레벨, 파편 수 제한 등을 설정할 수 있습니다. 파괴 후 파편이 무한히 쌓이면 성능이 저하되므로, 적절한 수명과 페이드아웃을 설정하세요.
핵심 요약
- Geometry Collection은 Chaos Destruction의 핵심 에셋으로, APEX Destruction을 완전히 대체합니다.
- Static Mesh를 Fracture Mode 에디터에서 분할하여 Geometry Collection을 생성합니다.
- Clustering으로 파편을 계층적으로 그룹화하여 단계적 파괴를 연출합니다.
- Damage Threshold와 Anchored/Kinematic/Dynamic 설정으로 파괴 조건을 제어합니다.
OnChaosBreakEvent로 파괴 이벤트를 수신하여 이펙트, 사운드, 게임 로직을 연결합니다.
도전 과제
배운 내용을 직접 실습해보세요
Static Mesh에서 Geometry Collection을 생성하고, Fracture Editor에서 Voronoi Fracture를 적용하세요. 조각 수를 10개, 50개, 100개로 변경하며 파괴 결과와 성능 차이를 비교하세요.
Geometry Collection에서 2단계 클러스터링을 설정하세요. 첫 번째 충격에 큰 파편으로, 두 번째 충격에 작은 파편으로 분해되는 계층적 파괴를 구현하세요.
C++에서 UGeometryCollectionComponent를 사용하여 런타임에 Geometry Collection을 생성하고, Fracture 패턴을 프로시저럴하게 적용하는 시스템을 구축하세요.