[Question] Animation for Swappable clothing and armour

We are currently working on a system where we can have weapon, equipment and Armour variety for both the player character and enemies. I’d like a little bit of feedback on our approaches and help with a few issues that I am having with the systems.

There are 2 ways we want to attach these items:

  1. Being bound to a socket and either being a static mesh or having its own small skeleton for jiggle physics; think sword for the first or shoulder pad for the second.

I only just started with these kinds of equipment and (other than setting the correct offset distance from the mesh when they get added dynamically but that is down the road) it works fine.

  1. Having them bound to the skeleton of the character we are attaching them to as a separate skeletal mesh. This is for large soft bodies like leather Armour straps or boots that cross over multiple joints like around the spine or feet (that aren’t handled by APEX which I’ve found works really well :slight_smile: )

The problems I am having here is having all the equipment play the same animations; is there a way to play the animation on only the root character and it gets passed down to all the other skeletal meshes (same skeleton as root) attached in the blueprint without having to pass the anim blueprint?

Thanks for the info,
Aidan

I believe this is the info that will be most helpful

the Master Slave skel mesh animation system

Epic comment 1

https://rocket.unrealengine.com/questions/15398/question-drive-two-skelmeshcomponents-in-one-skelm.html

different info different Epic response

https://rocket.unrealengine.com/questions/12083/question-attaching-bones-at-runtime.html

What Rama said.

void AGBClothing::OnAddInventory()
{
	Mesh->AttachTo(GBInstigator->Mesh);
	
	if (USkeletalMeshComponent* SkelComp = Cast(Mesh))
	{
		SkelComp->SetMasterPoseComponent(GBInstigator->Mesh);
	} ...

Thanks Rama that seems to be what we are looking for.

I actually took completely different approach than presented above. IDK if it is valid one, or good one, but it is easy to use.
Here is what I have done. In my character class I added X amount of components (where X is number of swappable mesh parts you want to use):

header:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=CharacterItems)
TSubobjectPtr ChestMesh;

implementation:

ChestMesh = PCIP.CreateDefaultSubobject(this, TEXT("ChestMesh"));
ChestMesh->AttachParent = Mesh;
Components.Add(ChestMesh);

Now I have special EquipmentManagerComponent that takes care of equiping items, removing them, setting stats, and other things that I haven’t yet thought about (;.

In the essence there is separate function for each item type, that will equip said item type to the character, the important part look like this:

					//we can just assign stats from item to the character
					SetCharacterStats(item, character);
					ChestSlot = item; //the assign item to the slot
					character->ChestMesh->SetSkeletalMesh(item->ChestMesh);
					EquipedItems.AddUnique(ChestSlot); //and add to array

And I have special class ARPGItem, which is well. Item. Important part for your needs:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=ItemAttributes)
USkeletalMesh* ChestMesh;

You of course need to assign separate animation blueprint for each skeletal mesh component in your character class. But that shouldn’t be a problem.

Above technique with setting master pose might be used in combination with this for adding items, that do not have rigid structure (like floating attachments).

We can safely assume that for humanoid characters legs will always be in the same place ;).

Edit:
I don’t know if using massive amounts of components is good approach for multiplayer game, as I really don’t know how they replicate across network. But since multiplayer is not my issue, I have very heavy use in components in game right now.

Tested out the master slave stuff and, bar placing things dynamically (ie scaling in and positioning things for different sized/per portioned characters) which we are now working on systems for, worked great.

Thanks for the input

Aidan