How to stop melee weapons from overlapping enemy Pawn's?

What is the best way, in regards to performance, when you want to have your Pawns stop their weapon swings on impact overlap? Stop animation, use IK?

I searched a little but not entirely sure how to approach this. Any links to tutorials, blueprint screenshots, or explanations, and hints for related readings are very welcome, thanks.

Well, i soon begin testing, any ideas or insights are still welcome :slight_smile:

Though it’s easy to throw theories around without actually doing it, my theory would be to use a combo of both animation and IK. You will need an animation that looks like you hit something, the body reacts, etc. But you will also need IK to stop the weapon in just the correct place. You may even need some sort of orientation correction on the pawn.

I think the real problem is just the variety of positions you can end up in when busy fighting an enemy, which is where you can use some sort of corrective rotation on the player so that he generally faces the same way when engaging an enemy, relative to that enemy. If you can have fairly predictable location/rotation on the pawn, you can have a system that reacts to that fairly convincingly without too much effort, I would assume.

I use a bit of corrective rotation on my character when detecting keyboard input so it’s easier to aim directly at an enemy, without having the precision of a joystick on a gamepad. It works really well and it’s pretty non intrusive. So I know that part can work. I’m thinking that depending on how aggressive you are with some sort of auto alignments, you may not even need IK.

I have this one system built specifically for when you stand too close to a wall, facing the wall and then pressing attack. normally you would hit and pass through the wall. So in this case I actually manipulate directly the capsule to just have a subtle push away from the wall. Subsequent attacks will then just be further from the wall until you stop attacking. This way I can have the body of the character away from the wall.

So, just to give you some idea I guess. Just think it through logically. Take some steps and test out the simple solutions first and step it up as needed. Try get a simple as possible solution. Even as simple as purely placing and rotating the capsule in relation to the enemy. Doing things like this over a small period of time, makes it very seamless and deliberate, and that’ll be pretty cheap.

Anyway, sorry I don’t have a straight answer, but maybe some food for thought. Most likely the solution is simpler than you first imagine.

Hi Obhib, indeed, i tried out below blueprint code, and it seems to work well On Hit event.

39bfdd7697398f99eafe3074b9de721fc7cc7f40.jpeg