Hit Event

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

The code above explains that OtherActor and OtherComp are actors that collide.
But only the data type is different, and both of them get collided, what’s the difference?

And I don’t know the difference between HitComp and OtherComp.

HitComp would be the component that was hit
OtherActor would be the actor that hit it
OtherComp would be the component that hit it (which would be a component on OtherActor)

Thank you for your response.

Of course. When the projectile hit BP_Projectile_C_1, ProjectileMesh came out as OtherComp. The reason why ProjectileMesh came out at this time is because ProjectileMesh was set to UStaticMeshComponent? Is that how it comes out because I set the UStaticMeshComponent under the name ProjectileMesh?

Yes, that’s the name you gave the component which hit the actor.

thank you for letting me know!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms