[UE5] Overlap Event Collision Filtering

ChangJin·2023년 12월 20일
0

Unreal Engine5

목록 보기
20/102
post-thumbnail

https://www.unrealengine.com/en-US/blog/collision-filtering

오브젝트 타입이 폰인 플레이어의 반응이 다른 폰과 WorldStatic에서 반응을 하도록 만들려고 합니다.

즉 어떤 Component에 다른 Component가 겹쳤을 때 Collision을 감지하고 event를 발생하도록 만드려고 합니다.

BluePrint로 만드는 방법이 있고
C++ 스크립트로 만드는 방법이 있습니다.

  • Collision Presets에 있는 Object Responses를 보면 Ignorem, Overlap, BLock를 설정할 수 있습니다.


  • BluePrint에서 component를 생성할 수 있게 만들어주고
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/BoxComponent.h"
#include "TriggerComponent.generated.h"

/**
 * 
 */
// BluePrint에서 이 컴포넌트를 생성할 수 있게 됨
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class CRYPTRAIDER_API UTriggerComponent : public UBoxComponent
{
	GENERATED_BODY()
	
protected:
	// Called when the game starts
	virtual void BeginPlay() override;
};

  • cpp 파일에서 UE_LOG로 충돌유무를 출력해봅니다
// Fill out your copyright notice in the Description page of Project Settings.


#include "TriggerComponent.h"

void UTriggerComponent::BeginPlay()
{
	Super::BeginPlay();

    UE_LOG(LogTemp, Display, TEXT("Trigger Component"));
}
profile
Unreal Engine 클라이언트 개발자

0개의 댓글