I don’t know the book, but as far as I can tell it seems to process the results from doing a sweep trace.
If the component hit by the trace is not the Root Component of that actor, we do nothing and exit the function:
if (OtherComp != OtherActor->GetRootComponent())
{
return;
}
Our weapon must be:
“Busy Swinging (assuming a boolean)”
AND “the actor hit with the trace must not be our owner/wielder (cha_WeaponHolder)” (we don’t want to hit ourself)
AND “we shouldn’t have already hit this actor before” (this is probably executed each tick so we don’t want to do damage on each tick - we will only do damage again when enemy gets within hitting distance again I assume)
if (Swinging && OtherActor != cha_WeaponHolder && !ThingsHit.Contains(OtherActor))
If all the conditions above are met, we do damage to the actor we hit: