Hi,
I’m trying to attach a meshcomponent to a socket of the skeletalMesh for my character. But I don’t why it doesn’t work ! Can someone help me ?
I tried different way, but nothing works for me.
Please help me !
Here my construct of my character class (cpp) :
EquippedObject = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("EquippedObject"));
EquippedObject->SetStaticMesh(Asset);
EquippedObject->AttachTo(GetMesh(), FName("RightHandSocket"), EAttachLocation::SnapToTargetIncludingScale, true);
TEXT("RightHandSocket"));
EquippedObject->SetGenerateOverlapEvents(true);
EquippedObject->SetCollisionProfileName("OverlapAll");
I also tried :
//EquippedObject->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::KeepRelative, true), TEXT("RightHandSocket"));
And :
//EquippedObject->SetupAttachment(GetMesh(), FName("RightHandSocket"));
Here, my socket :
And, on the player character inherited from my c++ character :