Attach actor to component not working - weapon sliding on floor

Hello,
I am again having an issue with my dedicated server…

My weapons (and my hair !) don’t attach… It was working well before with my listen server.

Here is how it works :

  1. The server spawn the weapon (spawn actor), it sets the owner, the relative location that should fit the right position etc. In the begin play of the weapon BP, the server attach it to the player socket.
  2. The client do the “attach actor to component” and attach the weapon to the hand socket.
  3. When pressing a button (equi/unequip key), then the weapon attach to the hand socket, and then to the back socket etc.

All this was working very well before with my listen server.

Now with the dedicated :

  1. the actor spawn well
  2. the actor seems to be attach to the root of the character, since if my player move arround the level the actor move with him BUT with the root component of the character and not with the socket I mentionned. I mean, the attach is not done, BUT it seems to be attach to the root since weapon are moving on the floor and jumping if I jump etc.

About my hair :
In my BP I have a skeletal mesh for the body, and a static mesh for the hair, which is attached to the head socket at launch. When launching the player, I take in the datatable which hair mesh should be use and then set the static mesh and then attach it (also in a repnotify for replication for all the clients and server).
It was also working before. But not anymore…

I don’t understand why it is acting like that. I think the problem is really the socket attachment, not how I do it. It is like if I was specifying a socket that doesn’t exist…
Maybe the dedicated server don’t see the socket as the listen server ?

Thank you for your help and time…

All the best

EDIT : new info, the problem occurs ONLY when I attach to a socket that I created myself in the skeleton (right click on a bone and add socket). If I attach to a bone, then the attach works… But it still a bad new, since I really need my sockets…

So, after days, I finally found the solution !
My mesh was created from a merge mesh (DoMerge in cpp). And after doing the DoMerge in my CPP, I wasn’t rebuilding the socket.
I don’t know why it was working in the editor, and not after packaging. But it is easy to solve.
Just add this line to your code after the DoMerge :
MyMesh->RebuildSocketMap();

MyMesh should be replace by your mesh you created using DoMerge.

And everything should be working fine after that :grin:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.