What is the Difference between Overlap and OnHit?

Can any one set me straight ?
A overlapping of actors is when a Actor with physics (player) over lap a none physical actor. (Fire) or a trigger box?
And OnActorHit is for when two physical objects collide right?

Btw the methods am referring to is.
AActor::OnActorHit and AActor::OnActorBeginOverlap

Also when is this called AActor::OnTakeAnyDamage ?
How do I damage a player or AI?

AActor:: AActor | Unreal Engine Documentation

2 Likes

The difference that I’ve observed between the two events is this:

OnActorBeginOverlap fires an event when the actor begins overlapping another actor (or whatever your actor’s collision component is set to overlap with). Your actor does not need to collide (block) the other actor for this event to fire. If you break the result (off the top of my head) it will give you the actor you overlapped, (surface info?) and not a whole lot more.

OnActorHit fires an event when the actor BLOCKS with another actor (your actor must be set to generate hit events in the collision properties). Overlapping will not fire this event, there must be a blocking collision. If you break this result you get the point location of the hit, normal vector information for the impact, as well as the other actor and surface information.

OnTakeAnyDamage is called when ANY type of damage is applied to the actor. Radial damage (explosions), point damage (trace hits, bullets for example), direct “ApplyDamage” calls, etc.

Your actor must be setup to receive damage (canBeDamaged bool set to true), and you can call “ApplyDamage” on it to fire the event. You then must deal with the event in the damaged class to decrement health by the passed damage value, or whatever you need to happen.

I’m not an expert on this stuff, but hopefully this helps you figure out what you’re trying to do.

2 Likes

It do thank you for that great and speedy explination. I have a follow up qustion touugh. :slight_smile:
May be a “dumb” qustion but goes, delegats are functions / events i can hook into.?

AActor you have the
/** Called when the actor is damaged in any way. */
UPROPERTY(BlueprintAssignable, Category=“Game|Damage”)
FTakeAnyDamageSignature OnTakeAnyDamage;

Concept is somewhat new to me .
Are they for hooking functions so i can “Pick up” a event on one actor from the second?
The documentation is somewhat confusing regarding this and the wiki is a bit over simplefied.

You declare them as so.

DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams( FTakeAnyDamageSignature, float, Damage, const class UDamageType*, DamageType, class AController*, InstigatedBy, class AActor*, DamageCauser );

And add them as so OnActorBeginOverlap.AddDynamic(objectPtr, &Class::FuFunc);
But dont understand what happens where do i pick up the signature?

for refrence am using A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
Network Tips and Tricks - Unreal Engine
Delegates and Lamba Functions in Unreal Engine | Unreal Engine 5.1 Documentation
UFunctions in Unreal Engine | Unreal Engine 5.1 Documentation

Am sure its not that hard once you manage to understand whats happening under the hood.

Thanks in advanced.

Unfortunately I’m not experienced enough with C++ to answer this, sorry. Hopefully someone else can chime in and help. You may want to post this as a separate question if you don’t get an answer .

Hi, i worked on event last week. I posted a question , you can see what i did, maybe it can help you.