How to access skinned mesh from skeletal mesh component

Im trying to pickup a gun. im using modular skeletal mesh for my character. i created a socket from arm mesh but i can’t access from code. i tried GetMesh but nothing happens, i also tried to access from GetMesh and SkinnedMesh but i cant access the arm mesh component

Hello BioFrost.in and thank you for posting.

In a similar post, Mhousse1247 provides a UE4 solution to obtain the socket itself.

Additionally, there is a hierarchy for the skeletal mesh component that may provide you a path on obtaining your skinned mesh Here is the API.

I hope the documentation and Mhousse1247’s solution provide adequate assistance.

What type of “modular” setup are you using and what’s the name of the socket? It’d be better if you explained your setup properly with more detail.

USkeletalMeshComponent *mesh = nullptr;
const USkeletalMeshSocket *socket = nullptr;

mesh = NameOfYourGlobalSkeletalMeshComponentVariable;

if ( mesh )
{
    socket = mesh->GetSocketByName ( TEXT ( "NameOfYourSocketHere" ) );

    if ( socket )
    {
         //
         //    Do something with your socket.
         //
         //    For example, something like this:
         //
         //    socket->AttachActor ( Weapon, mesh ) );
         //
    }
}