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"

Simple question about Hit-Events

Hi, I'm very new to UE4. I am currently writing my first Actor-derived class to get familiar with the API.

I just made a dynamic sphere that has an audio- and particleSystem component attached to it, so when it hits something, it goes boom ^^

I override NotifyHit for this. I started the project on the 3rd person template and when I run the character into this thing, it works as expected. But I can't figure out how to get the function to be called for static world collisions... I tried using different collision settings, but it didn't help.

Product Version: UE 4.9
more ▼

asked Oct 24 '15 at 04:06 PM in C++ Programming

avatar image

653 68 83 118

avatar image Matthew J Oct 26 '15 at 04:59 PM

How are you setting up your NotifyHit and which object is handling the resulting logic? What type of object are you trying to make your sphere hit? We'll need more specifics before being able to give any type of advice as to what is wrong in your particular situation.

avatar image MaxPower42 Oct 26 '15 at 07:28 PM

I declare virtual void NotifyHit (...) override; inside the new actor class.

The implementation only does this: audioComp->Play(); particleComp->ActivateSystem();

So the resulting logic is handled by the actor. I use a sphere-component as the root-component and enabled physics on it, so the event should be triggered here, I guess.

I want the sphere to react to any kind of hit (with a force-threshold). Collisions already happen, but not the notifyHit-call when dealing with world geometry.

avatar image Matthew J Oct 26 '15 at 09:17 PM

The first thing to check would be to see if the option for "Simulation Generates Hit Events" is on. This could be the issue if only character movement has been causing it to trigger. In the meantime, I'll be looking into reproducing the problem you're having.

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

1 answer: sort voted first

It's checked on the sphere-component, where I also checked simulate physics.

Wether or not I also check it on the level geometry doesn't seem to make a difference.

edit: I think I know now what's the problem. Apparently, the staticMesh (static sphere-mesh) component on the actor is also causing collisions, even though I didn't enable physics on it. Does this mean I have to set "no collision" on every static mesh I use, otherwise the engine will create a complex physx convex mesh shape for it (like the graphical mesh)?

edit2: Ok... so some meshes have primitive collision shapes attached to them. Before I ask any more questions, I guess I should take another look at the documentation. Thanks anyway.

more ▼

answered Oct 27 '15 at 05:04 AM

avatar image

653 68 83 118

avatar image Matthew J Oct 27 '15 at 02:59 PM

That is correct, when it comes to collision, if you already have a collision volume set up for your component, it is best to have the collision disabled, as the animations of the mesh could cause collision issues that aren't intended. Please let me know if you continue to have issues with this functionality.

(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