I’m trying to set up an Overlap End for a trigger box in c++. RepairStation is the name for this class. Here is the tBox set up.
In RepairStation.h
UPROPERTY(EditAnywhere)
UShapeComponent *tBox;
In RepairStation.cpp
// in constructor
tBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Trigger Box"));
tBox->bGenerateOverlapEvents = true;
tBox->OnComponentEndOverlap.AddDynamic(this, &ARepairStation::TriggerExit);
RootComponent = tBox;
TriggerExit function:
void ARepairStation::TriggerExit(class AActor* OtherActor, class UPrimitiveComponent* OtherComp,int32OtherBodyIndex)
{
//printing debug messages here
}
Below I’ve displayed my working TriggerEnter function.
In RepairStation.h
UFUNCTION()
void TriggerEnter(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
In RepairStation.cpp
void ARepairStation::TriggerEnter( class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
//Print debug message here
}
tBox->OnComponentBeginOverlap.AddDynamic(this, &ARepairStation::TriggerEnter); // in constructor
I currently have a working BEGIN overlap for the same tBox, set-up in the same way, although I pass a different delegate signature. The root problem is that the End Over lap function isn’t working, while the begin overlap does.
Any help would he appreciated.
Thank you.