How to animate hands and weapon together?

Here is what I have so far:

I have a first person mesh for the character hands and a mesh for the weapon (both have skeletons).

I placed them into sequencer, animated an idle pose. Then exported one animation for the hand and one for the weapon, then set them as default pose showing in Anim to Play in the character blueprint for each mesh.

Here is the hierarchy:

The hand animation works as intended, however the weapon mesh just stays fixed.

What is the correct setup to animate the weapon and the hands together?

The weapon is set to be attached to a socket in c++:

WeaponMesh->SetupAttachment(FirstPersonMesh, TEXT("hand_r_socket"));

I also set a constraint for the weapon in the idle animation so it follows the hand, which works in sequencer, but not ingame:

I looked at the shooter fps example included in the 5.7 project but that is cryptic:

It does not have a separate gun skeletal mesh in the hierarchy.

This is generally correct setup but constraints on sequencer is local it’s not the exact approach to it.
If you are attaching the weapon than in animation using constraints to animate the weapon aswell, it wouldn’t work. You need to drive your hands and weapon from animation bp basically its the director. Since sequencer is just a local animation data.

Driving the animation locally won’t help on runtime. I recommend even seperate blueprints for player and weapon itself, even further in a specific animation like reload : PlayerAnimBp->Drives(Reload)->DrivesWeapon(State), BP to BP communication can be interfaces, events, or notify driven states.

Ex:

FirstPersonStates

  • Idle
  • Kickback
  • Reloading
    *ReloadStart ->DriveWeaponAnimBP(DropMagazineState)
    *ReloadReady ->DriveWeaponAnimBP(ReChamberState)
    *ReloadEnd
1 Like