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"

Why is the Character mesh not generating Hit Events

Hi, I have a Character and at a certain point in-game its Root CapsuleComponent's collision is disabled and the SkeletalMeshComponent, the mesh, is set to Simulate Physics. The Mesh has blocking collision settings, Generate Hit Events checked and also Use CCD and Always Create Physics State.

The Hit Event and the OnComponentHit Event aren't fired once the Root has its collision disabled. The character, though, doesn't fall and can impact other world actors.

How to allow that events to be fired?

Product Version: Not Selected
more ▼

asked May 21 '14 at 06:04 PM in Blueprint Scripting

avatar image

Albert Espín
987 81 98 361

avatar image Albert Espín May 21 '14 at 06:09 PM

I've also tried, instead of disabling Root capsulse's collision, setting it to ignore WorldStatic and Pawn channels, and the mesh still doesn't fire Hit.

avatar image Steve Allison STAFF May 21 '14 at 11:04 PM

How are you trying to trigger the Hit events?

avatar image Albert Espín May 22 '14 at 04:38 PM

This is in BP. I've tried both with Hit Event and SkeletalMeshComponent's OnComponentHit. I've made sure they are not working in the exposed situation because they would perform Print String and have been marked with blueprint breakpoints with no notification while in-game.

Hit Event and OnComponentHit both work perfectly (are fired) with a channel if the RootComponent of the character blueprint, the CapsuleComponent, has a Block response to that channel, and that with all channels that meet the condition.

That makes me conclude that currently it seems that in UE4 the collision response of the ROOT in the character needs to be Block if one wants any other component in the character to be able to deal with Hit so collision with that channel is processed.

If this has currently a solution in UE4 I would be very thankful to read about it. Otherwise, take this comment as a request for solving this , I've made some request threads on the matter in past weeks but with no replies yet.

avatar image Albert Espín May 25 '14 at 08:26 PM

Any suggestions?

avatar image BiggestSmile May 25 '14 at 08:35 PM

alt text

Make sure this is checked on your mesh.

Edit: Sorry missed that line in your question..

avatar image Albert Espín May 25 '14 at 08:37 PM

Thanks, but it is.

avatar image AnxGotta May 26 '14 at 02:58 AM

I've been messing around with a few variations of his setup and am having the same results. I used the ragdoll C++ code I had and converted it to BP for the mesh. I disabled the capsule component and then enabled the ragdoll stuffs on the mesh to get it to fall to the ground. See BP image below. No HitEvent for the SkeletalMeshComponent called Mesh.

I did do a test with a CapsuleComponent and a SphereMesh that was a StaticMeshComponent that did what he wants. It read the HitEvent for the capsule, I disabled the capsule and enabled the SphereMesh, then the sphere static mesh fell and it registered the HitEvent.

It makes me wonder if the SkeletalMeshComponent for the player model doesn't have the same collision registration as the StaticMeshComponent. My static mesh sphere had a Collision Primitive on it from the mesh editor.

This is an interesting problem. I'm also interested to know what you are trying to achieve. We might be able to suggest an alternate implementation that would work for you.

alt text

avatar image Albert Espín May 26 '14 at 03:07 PM

Hi, AnXgotta, thanks for your time for responding.

I think that StaticMeshComponent Hit wouldn't be processed in a Character blueprint subclass, even if it does in a normal blueprint. In Character, I've seen that non-Root components (SkeletalMeshes, capsules, spheres...) don't fire Hit for a certain channel if the Root has Ignore response for that channel.

Also, if Root collision is blocking, apparently Hit for other components will be only processed if the Root capsule is also blocking against what is blocking the other component.

As you may agree, this is a limitation for a fighting game like the one I'm working on, so I can't detect Hits when the SkeletalMeshComponent's fist punches into another actor, just because the capsule isn't so big to cover the whole scene, but just the body of the character. Trying to make the Root capsule very big first leads to Monkey Ball-like weird effects, but then you have to disable Root's collision for some channels, but as said then you can't detect component's.

Currently I have a tracing solution implemented, which works pretty well, but I insist that it would be much better if in UE4 it was possible for Character components that are not Root to deal independently with Hit events. So if someone knows how to solve it I would like to know, if there's no way, take this as a request to implement what I believe would be a very important feature.

avatar image Zeustiak May 27 '14 at 09:24 AM

What if those components are not really attached to the player but exist in space and move similarly to the character component?

Lets say your fighting character does not have collision, but the 5-6 collision volumes attached to/above/etc his arms, legs, torso, and head do take collision?

I don't know how well you could make the volumes follow the movement of the character model(or how detailed your game must be in this aspect), but it could be worth a shot.

avatar image Albert Espín May 27 '14 at 04:12 PM

Hi Zeustiak, thank you, that's in fact a good idea, I tried out something similar with overlapping some time ago, but possibly because of an early bug with Begin Overlap that now is corrected it gave bad results.

With Hit it could be a good solution. The only problem I can think of is that the body capsules could bump with the Root capsule (that even if the mesh was not blocking the Root would need blocking collision to avoid falling and for some character-based functionality). This might be possible to solve using Tags. https://answers.unrealengine.com/questions/41678/how-to-set-an-actor-not-to-collide-with-one-specif.html

I'll try it out and tell about the results.

avatar image Albert Espín May 27 '14 at 09:34 PM

Ok, so I've tried using an auxiliary actor with a capsule component that is attached to the mesh's fist for punching detections. I've tried Overlap and Hit.

Hit gave probelms because just when spawning the blocking actor it made the character uncontrollable and buggy (it moved wildly against controls). The solution I wanted to use for this predictive case was use Tags in the auxiliary actor's Hit event so if it collided with its owner character it didn't block it. But I can't use this because Hit isn't being called for collisions with the character. It seems weird, but might be because it's at hand socket location, beyond the scope of the capsule, so again the collision detection being Root-capsule dependent is causing problems!

Overlap: I've tried, as an alternative, setting up "Get Overlapping Actors" with some Branches to see if the auxiliary-hand-collision-actor is overlapping another character and not self. As puzzling as it can seem, the attacking action is only processed if at start of the punching animation the attacker's auxiliary collision actor is touching the Root capsule of the other. So that's the problem with Root again!

I'm using Continuous Collision Detection and Physics Sub-stepping, so it can't be a precision thing.

So I thought it could be a problem with Attach, so instead of attaching the auxiliary actor to the character's mesh hand socket I've tried a crappy thing consisting in Set World Position of the actor to the socket location some times each second; the problem persists.

So my request for Root-independent collision for all components in a character BP subclass is still there.

avatar image Zeustiak May 27 '14 at 11:04 PM

Your collision channel presets on all the actors are set properly right? Your custom channel for your collision volumes should be set to Ignore for the player channel, and the player should be set to ignore for the volume channel(s).

Then you have channels for the enemy's character and volumes so that your volumes can interact with their volumes. Could get complicated depending on how many characters are fighting, but you should need at most 4 channels to cover 2 characters I think.

avatar image Albert Espín May 28 '14 at 08:33 PM

Thanks again, Zeustiak. I think this should work with one single channel for all players' characters, not 4 or more as you suggest, a channel for colliding only with other auxiliary collision actors, but that doesn't collide with, but ignore, any other thing in the world.

I've set up a new channel and assigned it to the auxiliary collision actor, and I'm spawning it at Begin Play and attaching it to character's SkeletalMeshComponent socket in the hand. It gets nicely attached in-game.

The auxiliary collider actor has "Object Type" set to the new type created, called "Collider". It has "Collision Enabled". It has "Ignore" responses for everything except of "Collider", which is "Block". It has "Simulation Generate Hit Events".

However, "Event Hit" just never fires in the auxiliary collider actor. Never. I've also tried it with "Simulate Physics" on, but nothing. I'm checking if it gets fired both with "Print String" and Blueprint Breakpoints, but it's never fired.

I must be missing something.

What could be preventing the axiliary collider actor to fire Hit events?

avatar image Zeustiak May 29 '14 at 06:14 AM

Have you tried all the simple collision options and the "Complex collision as Simple" option?

One more thing, if you haven't tried already, would be to attempt some trace hits or sphere overlaps on your actor. See if it works with that method then you have a better idea that it works, just not in the situation you want it to.

If you can get a line trace on it but it won't collide with the other objects, maybe you could play with the size of the volume? Expand the collision volume out a bit and see if you can get it beyond the influence of the capsule.

If that works then you may have at least confirmed it is a player capsule problem.

avatar image Max008 Jun 03 '14 at 09:46 PM

I have the same problem, so there is no solution ? :(

avatar image natemartinsf Jun 09 '14 at 01:32 AM

I think I'm also having a similar issue. I have a sphere subcomponent of my character, which I am trying to use to detect when walls are nearby.

I've also turned on "simulation generates hit events" on the sphere, but it doesn't seem to fire.

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

3 answers: sort voted first

Ok, so I figured this out last night and man is it simple!

On the physics asset, each capsule you have for the ragdoll has a "Generate Hit Events" tick box.

For the capsules you want to be able to generate hit events, you need to just click on the capsule and tick the generate hit events options in the physics asset. After that you just follow the normal steps to get it to work in the blueprint.

NOTE: Because there are multiple capsules, they generate hit events separately. So you might get numerous hit events instead of a single hit event.

more ▼

answered Jul 21 '16 at 03:25 AM

avatar image

728 20 25 108

avatar image hyperdr1ve Aug 15 '16 at 05:31 PM

This is the correct answer.

avatar image ErtieZone Mar 16 '18 at 06:11 AM

OMG MAN NO WAY!!!!!!!!!!! Dude really, you made my day, no joke. You found it!! Do you even know??? I even was half dropping a project because of this. I was already complaining about epic not releasing the mesh from within that damned capsule component. It is still not the most happy workaround knowing how much easier stuff could be if they changed some things but you sir made my day. Thank you.

avatar image GuaiamuStudio Nov 13 '18 at 11:02 PM

You saved my life today, thanks for that!!

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

I've found a nice solution for my situation, in which I had to detect accurately when a character punches another one, might not be the best for others' contexts, but here it's just what I needed.

Now when the punching event is fired, I activated a man-made sort of foreach loop ( Delays in actual flow control loops included with UE4 don't work ) in which a "Single Capsule Trace for Objects" is executed for each frame (I'm using Delay with "Get World Delta Seconds", which is the time in seconds corresponding to a frame duration, the reason to use this variable value and not a constant float is for performance: if FPS are really high the accuracy is maximum, as tracing is processed each very few miliseconds, but even under 10FPS it gives nice results without affecting performance).

The capsules of the trace are set to be in the location of the hand socket, I'm using "Get Socket Location", outputting from Mesh variable in the character, works for Bones as well.

If the capsule trace detects a character, the consequent actions are processed, and through the use of a bool the sort of loop mentioned above is stopped. After 0.5 seconds the loop is set to be stopped anyhow.

more ▼

answered Jun 14 '14 at 08:24 PM

avatar image

Albert Espín
987 81 98 361

avatar image AnxGotta Jun 21 '14 at 11:24 AM

Just to add to this... the frame rate issue in this trace style can be a big one. Especially in online play.

A way to fix this is to do a line trace from the socket position from one frame to the next and trace for player hits. Simply cache the socket location for this frame, then in the next frame iteration get the new position and trace from one to the other looking for character hits.

I made melee functionality in a different game and the frame dependent tracing isn't good enough, you need that extra trace between frame positions.

You may not need it, but just an FYI.

avatar image Albert Espín Jun 21 '14 at 11:38 AM

Hi, AnXgotta, I can see the point of what you say, even traces in 10 to 60 FPS aren't in ingame influence very different, I might implement something like that for an extra level of accuracy, so thank you, in very fast movements I could add in the future it would possibly be specially worth.

avatar image monkey_ Apr 17 '15 at 11:02 PM

Hi Albert, I made a lot of research on the issue you encountered and you seem to be the only one with a working solution. I've tried to implement it but I'm clearly missing the point. Could you please post a screen of your BP on this particular part ? I feel sorry to ask for something in my first post, but I'm on it since three days with little hope to succed.

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

maybe the answer to this

Link Here

may help with the troubles with the trace/hit problem? what I had to do is make a custom collision or trace channel to make it work.

more ▼

answered Aug 18 '14 at 08:35 PM

avatar image

133 25 26 30

(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