Use Overlapper in C++
Quick rundown of overlap queries in C++ which mirror blueprints very closely
1. Prepare the level
Follow Add overlap events through source and manager setup, naming your source Poison. Copy the complete header and source below into your game module, then build. The actor creates its Pixel Era Overlapper component.
- Create the componentOverlapper performs the query.
- Bind the eventsYour actor supplies the response.
Copy the C++
#include "PE_Overlapper.h"
AOverlapReceiver::AOverlapReceiver()
{
Overlapper = CreateDefaultSubobject<UPE_Overlapper>(TEXT("Overlapper"));
SetRootComponent(Overlapper);
Overlapper->Radius = 34.f;
Overlapper->Height = 180.f;
}
void AOverlapReceiver::BeginPlay()
{
Super::BeginPlay();
Overlapper->OnBeginOverlap.AddDynamic(this, &AOverlapReceiver::BeginOverlap);
Overlapper->OnEndOverlap.AddDynamic(this, &AOverlapReceiver::EndOverlap);
}
2. Handle Begin and End
Place an OverlapReceiver in the level and move it through the source mesh. bPoisoned becomes true on entry and false on exit. Both handlers receive source-name arrays and useUFUNCTION() for their dynamic bindings.

- Begin responsePoison enters the capsule.
- End responsePoison leaves the capsule.
Copy the C++
// Both handlers are declared with UFUNCTION() in the header.
void AOverlapReceiver::BeginOverlap(const TArray<FName>& SourceNames)
{
if (SourceNames.Contains(FName(TEXT("Poison"))))
bPoisoned = true;
}
void AOverlapReceiver::EndOverlap(const TArray<FName>& SourceNames)
{
if (SourceNames.Contains(FName(TEXT("Poison"))))
bPoisoned = false;
}
Add "PixelEraOverlap" to PublicDependencyModuleNames in your module’s .Build.cs.
Complete header
OverlapReceiver.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "OverlapReceiver.generated.h"
class UPE_Overlapper;
UCLASS()
class AOverlapReceiver : public AActor
{
GENERATED_BODY()
public:
AOverlapReceiver();
protected:
virtual void BeginPlay() override;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pixel Era")
TObjectPtr<UPE_Overlapper> Overlapper;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Gameplay")
bool bPoisoned = false;
UFUNCTION()
void BeginOverlap(const TArray<FName>& SourceNames);
UFUNCTION()
void EndOverlap(const TArray<FName>& SourceNames);
};
Complete source
OverlapReceiver.cpp
#include "OverlapReceiver.h"
#include "PE_Overlapper.h"
AOverlapReceiver::AOverlapReceiver()
{
Overlapper = CreateDefaultSubobject<UPE_Overlapper>(TEXT("Overlapper"));
SetRootComponent(Overlapper);
Overlapper->Radius = 34.f;
Overlapper->Height = 180.f;
}
void AOverlapReceiver::BeginPlay()
{
Super::BeginPlay();
Overlapper->OnBeginOverlap.AddDynamic(this, &AOverlapReceiver::BeginOverlap);
Overlapper->OnEndOverlap.AddDynamic(this, &AOverlapReceiver::EndOverlap);
}
void AOverlapReceiver::BeginOverlap(const TArray<FName>& SourceNames)
{
if (SourceNames.Contains(FName(TEXT("Poison"))))
bPoisoned = true;
}
void AOverlapReceiver::EndOverlap(const TArray<FName>& SourceNames)
{
if (SourceNames.Contains(FName(TEXT("Poison"))))
bPoisoned = false;
}
Updated Oct 17, 2026
