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?
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.
answered Jul 21 '16 at 03:25 AM
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here