I need help understand the parameters of the OnComponentHit function

I am confused from a tutorial using OnComponentHit function because the parameters names does not explain who is the object that got hit by a projectile, the projectile itself, actor that fired the projectile and the location and use of the static mesh parameter ?

This is what I found in documentation it is pretty useless

1 Like

Thanks for tutorial. I am still confused

OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)

I made that drawing :

Which one is the projectile, the actor that fired projectile and the target that get damaged in these parameters: HitComp, OtherActor, OtherComp

Let’s imagine a bullet and target…

HitComp = Component that was hit (target’s collision)

OtherActor = Actor who created the hit (bullet)

OtherConp = Component who created the hit(bullet’s collision)

1 Like

I see thanks alot and to get the actor that fired the projectile I use

AActor* Instigator = EventHit.GetActorInstigator();