트리거 박스 만들기
//동적 이벤트는 UFUNCTION()을 써준다
UFUNCTION()
//오버라이드
void OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
//cpp에서 재정의
void APlatformTrigger::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
//로그 출력
UE_LOG(LogTemp, Warning, TEXT("Actived"));
}
//BeginPlay()에서 오버랩시 호출할 함수를 델리게이트
//OnOverlapBegin을 해도 되고 직접 만든 함수를 넣어도 가능
TriggerVolume->OnComponentBeginOverlap.AddDynamic(this, &APlatformTrigger::OnOverlapBegin);
OnTriggerEnd 구현
//직접 함수 지정
UFUNCTION()
void MyOnOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
//델리게이트 콜백지정
TriggerVolume->OnComponentEndOverlap.AddDynamic(this, &APlatformTrigger::MyOnOverlapEnd);
//직접 지정한 함수로
void APlatformTrigger::MyOnOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
UE_LOG(LogTemp, Warning, TEXT("DePressed"));
}
'unreal engine' 카테고리의 다른 글
[언리얼엔진] ClientTravel (클라이언트트래블) (0) | 2022.02.19 |
---|---|
[언리얼엔진] ServerTravel (서버트래블) (0) | 2022.02.18 |
[언리얼엔진] exec를 사용한 콘솔 명령 (0) | 2022.02.18 |
[언리얼엔진] game instance (게임 인스턴스) (0) | 2022.02.16 |
[언리얼엔진] Tarray + trigger event message push (0) | 2022.02.13 |