Download

A question about using multiple skeletal meshes in a single character

Hi Friends:
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?

Thanks
Walter

Well the only way to know is to do it and there is always something that needs to be fixed as it is never about animations as a data set but about how control systems are added to create the kind of results your looking for on a given event. One can have a dozen or so key movement cycles but hundreds of single key “adjustment” poses to correct for unexpected behavior on a given event.

The sword example is a simple solution of using absolute animation meaning that how you animate it is how it is played back with out consideration of any other event driven influence. What happens if the player is hit mid cycle?

The only practical way I’ve seen of getting it done is to do it and see what happens under real game play conditions and the way to look at it all with a critical eye is getting it right is like putting together a puzzle with interconnecting parts.

What I find helps is to record your test session and look for areas that needs a wedge here and there.

I don’t know a lot about C++ but this all can be done with blueprints very easily and without a ton of skeletons. First off your sword and scabbard could be physics objects so they won’t overlap too much. You can also have your motion (idle, walk, run, jump) and then blend them with other animations. In other words the legs are running but the upper body is switching between different animations based upon the weapon. As far as the bow goes that might be a situation where a morph target makes more sense, but morph targets tend to be a much heavier load on the client’s system. It just seems to me all those skeletons are a lot of work.

There’s a reason games don’t have a scabbard for swords that the character draws the blade from. Because it’s an almost impossible task given the state of the art. The blade will clip through the scabbard, etc.

Multiple skeletal meshes for a character by itself I’ve never seen done. It would just multiply your workload needlessly when you can get “close enough” with one.

Game development is all about knowing where to put in the effort, what aspects to perfect and what can be left at 90%. Perfectly drawing a sword, or matching a bow draw/fire animation perfectly gets into incredibly finicky territory.

Personally I’d just have a character mesh, and use attachment points to attach weapon models. Then just animate what you’ve got.