언리얼
Unreal) 캐스팅하고 액터 부착 (AttachToComponent)
HJH0825
2024. 10. 28. 22:18
가고일 석상으로 인해 문이 내려가다가 멈춘다.
이 가고일에 컴포넌트에 접근하여서 물리적용 해제 하기
if (Actor != nullptr)
{
UPrimitiveComponent* Component = Cast<UPrimitiveComponent>(Actor->GetRootComponent());
if (Component != nullptr)
{
Component->SetSimulatePhysics(false);
}
Actor->AttachToComponent(this, FAttachmentTransformRules::KeepWorldTransform);
Mover->SetShouldMove(true);
}
- UPrimitiveComponent`는 Unreal Engine에서 사용되는 주요 컴포넌트 중 하나로, 모든 "기본적인" 렌더링 가능 컴포넌트의 기본 클래스
- SetSimulatePhysics(bool) 물리 시뮬레이션 on/off
- AttachToComponent : RootComponent를 제공된 구성 요소에 연결
결과