I’m trying to get melee attacks to work properly. It’s doing damage but rather than applying it once per hit it’s doing so anywhere between 2 and several times each swing.
If I’m moving foward as it happens it seems to do it more. If I stand still and punch it will apply two or three times depending on the distance to the other character. If I’m running into her and punching, it shows up 7-8 times.
Is my melee system.
Is the OnComponentOverlap
is the other characters take damage.
I have to two collision capsule’s. Once on each hand of the mesh. They are quite small.
It was still doing damage multiple times so I tried a few things, one being an anim_notify that enabled and disabled the capsule collision. Seemed to have no effect.
The hand capsule’s are both set to “No Collision” enabled at the start. It’s called through during an animation and then disabled. I’ve tried lowering the amount of time between enable and disable in the anim_notify’s by bringing them together but it makes no different.
Looks very complex. Here are some general observations you may wish to consider:
You are trying too hard to be realistic. Don’t. Games simulate a lot of stuff, embrace that. Implementing collision spheres in your hands is not going to work very well with constant movement. It will keep firing as many times as these overlap. The reason why it applies several times (more if you move) is because you overlap several times with the animation and movement. Fake it instead. Implement along these lines (copy and paste from one of my projects).
Check for the right targets using some sort of interface. See my example above. You can implement “IsDamageable?” Interface. It will scale much better, and will be much easier to manage than using tags.
Also, in addition to the above - check whether or not your traces are returning individual bones that are hit on the skeleton. Sometimes that will appear as duplicate results, because it will return the same actor, even though it’s hitting each bone only once.