Hey GUys,
I’m trying to get event for hit or collide/overlap with another actor but without success.
my code is here:
GetCapsuleComponent()->OnComponentBeginOverlap.AddDynamic(this, &MyChar::onSomethingOverlap);
GetCapsuleComponent()->OnComponentHit.AddDynamic(this, &MyChar::OnHit);
void MyChar::OnHit(UPrimitiveComponent * selfComponent, AActor * selfActor, UPrimitiveComponent * otherActor, FVector normalImpulse, const FHitResult& hit) {
UE_LOG(LogSomething, Warning, TEXT("hit man down"));
}
void MyChar::onSomethingOverlap(UPrimitiveComponent* overlappedComponent, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult &sweepResult) {
UE_LOG(LogSomething, Warning, TEXT("overlap"));
}
My Pawn collision profile is: Pawn and other actor that is hitting my pawn is WorldDynamic. that i wanna do is when actor hit my pawn to register event on my pawn and do staff in code.
what i’m missing in here?