Socket placement

So i have a pickup system that plays this code HoldingComponent->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true), TEXT("Hand"));
It works fine but the meshes are going to the wrong position in the socket, i could fix it by moving the socket but i am using multiple meshes in my game so it would be great if somebody could tell me how could i make meshes go in the correct rotation axis with multiple meshes with different rotations in need.
The meshes attach to the socket but the meshes are rotates the wrong way!

333941-kuva2.png

Can you please show the hierarchy of bones and sockets.

here is the picture if you ment the skeleton tree.
If you ment something else could you specify what you mean with hierarchy of bones and sockets.
:slight_smile:

I hope this can help.

Oh i think you misunderstood my problem, the pickup system is working fine but when i take the mesh to the hand i would like to change the meshes rotation but every mesh i would want a different rotation cause in my example pictures above the knife is backwards and the axe is sideways. I would want to find a way to rotate meshes so they would not look weird in the sockets

In the case of several meshes then you should create several sockets to position the elements correctly.

Yes, I understand, my English is very bad. Create several socalos, one for the knife, and one for the axe. That way you can correctly square the rotation and position. Another question is that I don’t know at what point the axe and the knife have the same rotation in the modeling program.

Edit:

how would i do that in code?
and i have the whole pickupsystem in code so i cannot do it in blueprint (some things i can do)
how would that work cause you would have to seperate the mesh and use a if statement maybe?

how would i do that in code to make the pickupsystem seperate the meshes and put them in their different sockets depending on the socket

What I think, is that you can execute two sockets visually having as parent the same bone.

In my case, my character can Helmet a case, but if it is without a case, it can have glasses or not. In such a case I create two sockets in the desired position and rotation for each element that will be on the head.

I also think that by programming you can access that particular socket and change its rotation, position and scale.

But I don’t know how to do it, but I’m sure you can, but the easiest way is to create those two sockets, one called in your case axe, and another called knife.

This is likely to help.

thank you i will try this when i get to!
will inform if i succeed or not but thanks for for the help anyway!