Download

Overlap Begin fires, but not End

Made an object with only a mesh and a collision sphere. Created another volume on my character for the specific purpose of detecting this type of object.

Currently, the begin event fires normally and I see the results of the delegates on both objects. When I exit the sphere, however, no end event is fired on the character, only on the object. As a test, I assigned a print statement on the character blueprint instance of the volume to the overlap end event and it returns properly. This tells me that I must be doing something wrong in code, somewhere, but it all looks fine.

Here are the delegate assignments:



	InteractableCapsule->OnComponentBeginOverlap.AddDynamic(this, &ADefaultCharacter::OnCapsuleOverlapBegin);
	InteractableCapsule->OnComponentEndOverlap.AddDynamic(this, &ADefaultCharacter::OnCapsuleOverlapEnd);


The function definitions in the header file:



	UFUNCTION()
	void OnCapsuleOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
	UFUNCTION()
	void OnCapsuleOverlapEnd(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);


If anyone thinks it could be the problem, I can also put the delegate functions. As always, any help would be greatly appreciated as this has been giving me ulcers.

I’ve verified and reverified that the signature for the OnComponentEndOverlap delegate is right and the delegate assignment is right. Does anyone have any other possible idea what could be wrong? Even a guess as to where else I should look would be great.

So I had to return to the states for a bit and wasn’t around my PC to mess with this more and unfortunately didn’t get any more attention on the question, so I’m still wondering why this is happening.

As an update, I just hooked up events in the character blueprint specifically to the capsule collision component with simple print statements. It worked as expected, only triggering when moving in and out of an intractable object’s area. The binds in C++ cause the events to fire as if the events were bound to the character, rather than the component, so I get overlap events on everything, including a weapon being held.

Why? Maybe I don’t understand the implications of the “Component” in “OnComponentBeginOverlap”, but I’d thought it would only register events on the component…? Code below:


InteractableCapsule = ObjectInitializer.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("Interactable Capsule"));
	InteractableCapsule->AttachTo(RootComponent);
	InteractableCapsule->SetRelativeScale3D(FVector(2.1f, 2.1f, 2.1f));

	InteractableCapsule->OnComponentBeginOverlap.AddDynamic(this, &ADefaultCharacter::OnCapsuleOverlapBegin);
	InteractableCapsule->OnComponentEndOverlap.AddDynamic(this, &ADefaultCharacter::OnCapsuleOverlapEnd);

In the meantime, I guess I"ll just make the functions usable in BP and hook them up there. I just want to understand why this is happening.