2D Sidescroller C++ Example project: collision functions not called

So I’ve been trying to get collision to work when the 2D player character lands on the ledges, or hits his head on a ledge (when jumping from below a ledge). Googled quite a few methods:

I started a brand new project and in the constructor of the MyProjectCharacter.cpp, I have:

GetCapsuleComponent()->OnComponentBeginOverlap.AddDynamic(this, &AMyProjectCharacter::OnOverlapBegin);
GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &AMyProjectCharacter::OnThisHit);
OnActorHit.AddDynamic(this, &AMyProjectCharacter::OnHitActor);

And I have these functions set up:

void AMyProjectCharacter::OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    UE_LOG(LogTemp, Error, TEXT("Collision detected 1"));
}

void AMyProjectCharacter::OnThisHit(AActor *SelfActor, UPrimitiveComponent *OtherActor, FVector NormalImpulse, const FHitResult& Hit)
{
    UE_LOG(LogTemp, Error, TEXT("Collision detected 1a"));
}
void AMyProjectCharacter::OnHitActor(AActor *SelfActor, AActor *OtherActor, FVector NormalImpulse, const FHitResult& Hit)
{
    UE_LOG(LogTemp, Error, TEXT("Collision detected 1b"));

}

void AMyProjectCharacter::ReceiveHit(class UPrimitiveComponent * MyComp, AActor * Other, class UPrimitiveComponent * OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult & Hit)
{
    UE_LOG(LogTemp, Error, TEXT("Collision detected 1c"));
}

But none of these functions get called. Any idea what I’m missing?

Hello ,

What kind of results do you get now with your collision, ignoring these functions? As in, does your character collide with any of these platforms at all? If not, are you sure that the Y location (Or whichever axis you’re not using as part of your 2D set up) is the same for the character and these other objects? Have you checked the collision settings for the character and the other objects? For overlap events, they’ll need to be generating overlap events and the collision channels will also need to be set to block (for hits) or overlap (for overlaps.)

We haven’t heard from you in a while, . Are you still experiencing these issues? If so, could you provide the information I asked for in my previous comment? In the meantime, I’ll be marking this issue as resolved for tracking purposes.