Last active
September 30, 2024 14:57
-
-
Save sephirot47/2b9883d1d7d1a3feb4b3 to your computer and use it in GitHub Desktop.
UE4 OnBeginOverlap - OnEndOverlap (Collision stuff)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For Components ================================= | |
UFUNCTION() | |
void OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult); | |
UFUNCTION() | |
void OnEndOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex); | |
// Register events in BeginPlay | |
OnComponentBeginOverlap.AddDynamic(this, &MyClass::OnBeginOverlap); //Register the BeginOverlap event | |
OnComponentEndOverlap.AddDynamic(this, &MyClass::OnEndOverlap); //Register the EndOverlap event | |
// ================================================= | |
// For Actors ================================= | |
UFUNCTION() | |
void OnBeginOverlap(AActor* ThisActor, AActor* OtherActor); | |
UFUNCTION() | |
void OnEndOverlap(AActor* ThisActor, AActor* OtherActor); | |
// Register events in BeginPlay | |
OnActorBeginOverlap.AddDynamic(this, &MyClass::OnBeginOverlap); | |
OnActorEndOverlap.AddDynamic(this, &MyClass::OnEndOverlap); | |
// ================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. Registering the events in the constructor doesn't work anymore.