How to achieve realistic melee combat

Hello everyone, what i want to specifically achieve is, when the sword my character has equipped collides with another static mesh, i want the sword to be blocked and also i want the arm bones to shift with the sword. I have tried using the physics handle to equip the sword this way the sword is blocked by staticmeshes but the arm goes straight through. I need them to be synced. Any help is appreciated

this sounds like a job for the wonderful world of Inverse Kinematics (IK for short)

the “most common” applications for IK is walking (so that feet don’t poke through the ground…), but it is to have physics inform the animation rig.
for an application about the hand/arm: I have not followed this tutorial/guide myself

1 Like

this would be useful if i was aiming to only have the hand be blocked but i need the hand to adjust when lets say the tip of the sword is being blocked, the hand should follow the swords hilt. I know that to do this i need to use IK but i cannot think of a way to do all of this normally.

when the tip rotates/moves the root of the object will move that is the purpose of IK.

is this to be a consistent thing Like the character shall always have a sword? or will this be a bit more dynamic where the character might change weapons?

could you set the sword itself as a constraint of the hand/arm? (this might fall apart for changing weapons), if the “Sword” is a child actor try to get the StaticMesh Component of the child actor and dynamically setting that as a constraint.

another more clunky way would be to directly manipulate the hand based on the transform of the weapon, but this might break animations more then improper IK solver/goals.

the character will change weapons. Could you please elaborate about the constraint thing, also i have tried updating the transform of the hand based on the weapons transform but like you said it does mess things up

a Skeletal mesh has an accessible member called Constrains TArray<FContraintInstance*> (FConstraintInstance | Unreal Engine 5.2 Documentation) , so you could try creating one of those and try adding it dynamically that way.
you might also need to add not only the sword as a constraint of the hand/arm, but also the hand/Arm as a constraint to the sword.