Download

Hit event just wont work

I’m trying to create a melee combat system. However, event hit just won’t work and overlap does not return me the information i need.
The hit event from the weapon(blade channel, custom one i created) just trigger if it hits the capsule component(Pawn preset) but it never triggers when i hit the Mesh(Mesh Channel, custom one i created). However, the hit event on the capsule(Pawn) works, but triggers extremely “badly(sometimes it just won’t trigger)”
Overlap seems to work fine.
I’m doing the “same”(the difference is mostly the collision channel) setup for my projectile and works perfectly, so i don’t know what i’m doing wrong.
Here are the screen shots from the projectile, blade , capsule and mesh channel i’m using.
I also all kind of different setups for the collision and it wont work(the mesh collision is set to overlap the blade channel but i used the block option aswell), even using the same collision and channel type as the projectile. And yes, i tried setting “block” the blade channel on the mesh, it won’t work aswell. I can guarantee that the weapon mesh has a collision setted.

EDIT: I’m using animations to try a hit on an enemy, but with/without animations hit seems to not work.

Capsule :

Mesh :

Projectile :

And the Blade(Melee Weapon) :

Your ignoring the pawn

That’s the purpose. The pawn is the capsule. I don’t want to hit the capsule, i want to hit the mesh. This method works perfectly fine with my projectiles but won’t do anything with the sword. I think i said that already?

EDIT:: I’ve done some more testing. I added a projectile movement to the weapon and the hit works perfectly fine. The problem apparently is entirely on using animation to move the weapon and generate the hit event. Any idea why and how to fix, or if this is the problem?

afaik a hit event requires at least one rigid body simulating physics.

(There may be ways to bypass this using kinematic actors and special flags)

But, in general, for melee type weapons driven by animation, it is often better to use line trace or sweep out the shape manually.

But if you really must use overlap or hit events, make sure to use ccd.

Also note the animation may skip many frames, so you will not necessarily have a smooth arc.

Rama has a melee plugin you can buy:

I followd your advice and i’m using a line trace for the sword collision. Seems to work fine now. Unfortunatelly i can’t buy the plugin because i don’t have a credit card… bad luck for me xd

Glad its working :slight_smile:

For future reference, it looks like as long as you use “Sweep” when moving, then a non-physics body will still generate rigid body collisions.
Under the covers, this is implemented as an underlying Physx sweep of the shape.