x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/index.html

Product Version: Not Selected
Tags:
more ▼

asked Apr 17 '14 at 02:30 PM in C++ Programming

avatar image

WCode
508 43 44 73

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 17 '14 at 03:07 PM

avatar image

nopunintendo
405 11 18 36

avatar image WCode Apr 17 '14 at 03:45 PM

It do thank you for that great and speedy explination. I have a follow up qustion touugh. :) May be a "dumb" qustion but here 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 https://wiki.unrealengine.com/Event_handling https://www.unrealengine.com/blog/network-tips-and-tricks https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Delegates/index.html https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Functions/index.html

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

Thanks in advanced.

avatar image nopunintendo Apr 17 '14 at 05:34 PM

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 here.

avatar image 42EspoiR Apr 29 '15 at 03:22 PM

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

https://answers.unrealengine.com/questions/215250/broadcast-event-cpp-not-call-my-function.html

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question