Overlap Event not being called

Hi,

I am trying to have my StaticMeshComponent generate overlap events on overlap with the Pawn ECollisionChannel. I set up my staticmeshcomponent to achieve this in the constructor for my class. This actor is attached to the player, who is ignored within the collisions of the actor, I have also noticed that it does not seem to block EWorldStatic objects either so is there some simple setting I am missing?

Thanks for any and all help :slight_smile:

Also, if I declared a simple collision capsule around my object in my static mesh object (from the editor), will the static mesh component use that simple collision object for its’ interactions, or will it use the complex one?

My Actor Constructor

ACharWeapon::ACharWeapon(const class FObjectInitializer& FOI)
{
	//Explicitly No Ticking of Weapon Classes
	PrimaryActorTick.bCanEverTick = false;

	// Create Static Mesh Component
	StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));

	StaticMeshComponent->BodyInstance.SetObjectType(ECC_WorldDynamic);

	StaticMeshComponent->OnComponentBeginOverlap.AddDynamic(this, &ACharWeapon::OnOverlapBegin);

	StaticMeshComponent->bGenerateOverlapEvents = true;
}

My Collision function declared in the ACharWeapon header file

	void OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
		UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

My Definition of the function

void ACharWeapon::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT(
		"CharWeapon: Successuflly overlapped other actor")));
}

My Setting up of the Collision responses, ECC_Player is a collision channel I setup to represent the player to seperate it from Pawns.

void ACharWeapon::PlayerSetupCollision()
{
	StaticMeshComponent->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
	StaticMeshComponent->SetCollisionResponseToChannel(ECC_Player, ECR_Ignore);
	StaticMeshComponent->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
}

So I got a notification that my question had an answer in an email, and the answer was completely correct, I came up here ready to upvote that answer, but it was deleted or is not here?

So, thanks phoenix[illusion] for the answer, I thought there was probably some silly mistake I was making.

The answer btw, was that my OnOverlapBegin function was not declared as a UFUNCTION()

If phoenix’s answer shows up again in the next few hours, I will upvote and accept that answer instead, otherwise I will just accept this answer as the solution

Hi MechaFarin, yes I posted the answer, but thought it was a bit silly, that’s why I deleted it. In the end it was the solution, OnOverlapBegin function was not declared as a UFUNCTION(), which is unnecessary for overlapping events to work. Glad it helped you.

Cheers!