I am trying to get a function to call in my pawn class whenever my pawn bumps into something or hits it. (It’s going to damage the ships shields based on how hard I hit an object.)
I am using a pawn with the starter content UFO guy for now as I get the game working.
I am trying to simply override the NotifyHit function Here’s what I’ve got:
In the Pawn’s header:
UFUNCTION()
virtual void NotifyHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit) override;
In the Cpp:
void ATestPawn::NotifyHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit)
{
GEngine->AddOnScreenDebugMessage(1, 15.0f, FColor::Red, "I am being notified of a hit.");
}
I do not get into this function at all.