이것저것
[UE4] BoxComponent Overlap C++ 사용 본문
728x90
C++에서 BoxComponent나 CapsuleComponent같은 콜리전 충돌여부 함수
// Header
UFUNCTION()
void OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
// CPP
ClassName::ClassName()
{
m_pBoxComponent->OnComponentBeginOverlap.AddDynamic(this, &ClassName::OnOverlapBegin);
}
void ClassName::OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (OtherActor && (OtherActor != this) && OtherComp)
{
// ... 태그를 활용해서 구분해도 됨.
}
}
그밖에 End도 존재
기본적인 Event 관련해서는https://api.unrealengine.com/KOR/Engine/Blueprints/UserGuide/Events/index.html#eventactorbeginoverlap
'[언리얼] Unreal Engine 4 > 기록해두자..' 카테고리의 다른 글
[UE4] 현지화 로컬라이징 해보기 (6) | 2019.10.09 |
---|---|
[UE4] 프로젝트 초기화 73% 멈추는 문제 (0) | 2019.09.28 |
[UE4] 플러그인 만들어보기 (0) | 2019.09.23 |
[UE4] Media Player 사용 (0) | 2019.08.13 |
[UE4] Float과 String 형변환 (0) | 2019.08.13 |
Comments