I would like to ask what is the typical solution of this problem:
In FPS/TPS game, the character can carry a lot of weapons(sword/bows/guns/….), and for each kind of weapon, character will perform an unique kind of animation to operation that specific weapon, for a sword, he/she can only extract/slash it, for an arch, he/she can shoot it by using bows.
Consider some weapons will have to deform during animation, for bowstring, it will become tighter, for sword, you need to extract it from sheath, I would like to add skeletons on that weapon so it can deform exactly as I want (sword accurately extracted from sheath without overlapping with sheath in 3d space). So, in order to add new weapons and its corresponding animations to our character, I think I should first in Maya created multiple set of skeletal meshes, each one has an unique root joint, for example, a joint-tree for character’s body, a joint tree for sword, a joint tree for bows, and I can make a lot of animations with multiple skeletal meshes in Maya, then import them into UE4. Thus, for our character, it will have multiple skeletal mesh components, and each one will have to have an different animation blueprint, and different animation montage. When I want to perform a slashing action: I can call this in C++ (pseudo code):
void Character::OnSlash( )
UAnimInstance* AnimInstance = BodyMesh->GetAnimInstance();
AnimInstance->Montage_Play(Slash_BodyMontage, 1.f); // this is async, it won’t block thread.
UAnimInstance* AnimInstance1 = SwordMesh->GetAnimInstance(); AnimInstance->Montage_Play(Slash_SwordMontage, 1.f);
And of course in Persona, I’ll have calibrate two animation montages’s play rate/end time to prevent mismatching between hand and sword.
So how do you guys think of this solution for adding complex weapons to character?, I knew I can add a socket to attach static meshes, but I think that will not even able to accurately extract a sword……
btw, a character with multiple skeletons, the number of bones in sum don’t have to be lower than 75 on mobile, right?