Download

Animating 2 objects at the same time in ue4

Hello everyone,
So i’ll try to make this as clear as possible.I would like to create a fps animation of a weapon realoading. I already have my 3d models : the hand and the weapon.Now when I am going to animate these 2 objects together i will be animating both objects at the same time.Now my question is : how do you make those 2 objects interact together in ue4, as these are seperate objects ? For example the hands pulling the magazine out of the gun.How could I do that?
I asked for some help here because I didn’t find any tutorials about this. I hope you understood what I meant.Thanks for the help :slight_smile:

The way I do it is make a single animation in a scene containing both rigs (the character rig and the weapon rig, I assume your weapon is a skeletal mesh rather than a series of static meshes?) and then export each one separately.

Then in UE4, right after the player reload animation is triggered, I Cast to the held gun mesh and play the corresponding animation. They line up just fine (though you may need the gun to be set up as an actor and to have its own anim BP for this to work properly; when I’ve done it I’ve been synchronizing animations between a player and an enemy character for grab attacks, so the enemy already has an anim BP that I can use to trigger animations. I know you can play anims by themselves for skeletal assets without an anim BP but there’s a maximum complexity and IDK what that limit is).

The trick to getting this right is understanding the way the roots interact. If the gun is attached to the player’s hand via socket, for instance, then it’s very important that in your animating software, the same attachment is made with parenting or constraints to hold the weapon skeleton to the player rig’s hand. This way, when you export just the gun’s animation, the root of the gun remains stationary (rather than moving around as if led by an invisible hand).

Or do vice versa, animate so that the gun IS led around by an invisible hand (you may need to do this if the reload animation is exceedingly complicated), but before triggering the animation, detach the gun from the hand socket and attach it directly to the player capsule at 0,0,0 relative space (or wherever the weapon’s original root is in your animating software). The point is, wherever the root of the gun rig is in UE4 relative to the player MUST be the same when you design the animation, otherwise the motion of the animation will be combined with whatever offsets UE is trying to do at the engine level and break the illusion of interaction between player and gun.

Ok thanks for the reply mate i’ll try it out soon :slight_smile: