Download

Is there a skeletal mesh equivalent to AttachToComponent?

I’m trying to child a skeletal mesh component to my character’s mesh for each article of clothing they wear, so that they inherit the master mesh’s transform and move correctly after I slave them to the master pose component:


	USkeletalMeshComponent* baseShirtMesh;
	baseShirtMesh->AttachToComponent(GetMesh(),FAttachmentTransformRules::SnapToTargetIncludingScale);

This obviously doesn’t compile, because AttachToComponent isn’t a method for skeletal meshes, only (I assume) for static meshes. I’ve been combing through USkeletalMeshComponent | Unreal Engine Documentation but I don’t seen an alternative, is there an obvious way to child one skeletal mesh to another without resorting to blueprint?

you should attach the cloth/weapon skeletal mesh components to the main skeletal mesh component (I do it in Blueprint by dragging the additional sekletal mesh components onto the main skelmesh comp), then apply ClothOrWeaponSkeletalmeshComponent->SetMasterPoseComponent(MainSkeletalMeshComponent) and they will be animated fine.

Ooh perfect, thank you! :slight_smile: