OnComponentBeginOverlap not working as in doc

I’ve been trying to learn c++ programming for ue4, and right now I have a problem with overlap detection.
In the C++ programming tutorial, checking overlaping is done by iterating through all objects that are curerntly being overlaped, but with what I’m trying to do I believe that running a function at the time overlaping started would be more useful.

Right now I’m using the base First Person Shooter C++ template.

I’m trying to make the overlapping exactly as described here.

Instead of creating another object, I’m just calling

GetCapsuleComponent()->OnComponentBeginOverlap.AddDynamic(this, &AVRTestCharacter::OnTriggerEnter);

Here’s the function declaration in the header (I’m using the BlueprintCallable macro so I could check that is being recognized in the blueprint view):


UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Collision")
void OnTriggerEnter(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult);

And here is the function implementation:

void AVRTestCharacter::OnTriggerEnter_Implementation(AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherActorIndex, bool bFromSweep, const FHitResult &SweepResult) {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Blue, "colisao chamada " + OtherActor->GetName());

	if ((OtherActor != nullptr) && (OtherActor != this) && OtherComponent != nullptr) {
		#if UE_EDITOR
			GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Blue, "Colidiou com o objeto " + OtherActor->GetName());
		#endif
	}
}

I’m using the _Implementation in the function implementation because I couldn’t compile otherwise.

I’m pretty sure the overlapping is happening because I tried to check it using the blueprint OnActorOverlapBeging event on the event graph for the same object.

No idea what to do now about this, any help is appreciated.

Have you enabled ‘generate overlap events’ ?

Yep, on both. Just to make sure I tried turning it on and off and making the same thing in blueprints, and it worked as expected.

How are you setting up your collision object type and response types?

Not sure what that is specifically, so I can’t answer that hehe
However, if the overlapping is being detected in bp, shouldn’t it be detected in the code too?

Ok so I found out the error. Not sure if it is a bug or a documentation fault, but binding in the constructor DOES NOT actually bind the function, that must be done in another function.