Download

How do I subscribe to a collision event?

I want to subscribe to a capsule component hit event.


void AMyPawn::OnCapsuleHit(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{

}

The problem that I have is that there is no .AddDynamic anymore.


CapsuleComponent->OnComponentHit.AddDynamic(this,&OnCapsuleHit);

There is only .Add. How do I subscribe to this event in 4.7.3?

Hope this will help [C++] Collision detection? - UE4 AnswerHub

The problem is that AddDynamic seems to have been removed and all docs for delegates are only approved for 4.5.

I can only see .Add which needs a TScriptDelegate but I think that is a Blueprint thing.

Okay wow it really works, my function signature was just wrong. AddDynamic is a macro and not a method, that confused me for a while.