Attach 2 Static Mesh Actors Togather Via Sockets

Racking my brain and looked and looked but does not seem possible. Take 2 simple static mesh boxes and make one socket on each box. In the blueprint use the AttachToActor and choose both boxes and the socket name for one of the boxes. Hook this up to a keyboard key.

Play and then press the key, what will happen when you run this is the socket from one box will attach to the pivot point of the second box. Is there a way to attach attach box one socket to box 2 socket.

The AttachToActor only has one socket option, it would seem like you would have another socket option for the 2nd actor.

I am making a build system and trying to snap one piece to another at run-time and though that snapping 2 sockets would be the easiest way but it does not seem like you can snap 2 sockets together.

Someone has to know if you can snap 2 meshes together using sockets??

Sorry, slightly confused by the question, when you say “Play and then press the key, what will happen when you run this is the socket from one box will attach to the pivot point of the second box.” do you mean that ONLY the socket, and not the entire box are snapping to Box1? You should be able to just use Attach to Actor → Box1 as the Parent, with socket Box2 as the Target.

You simply need to get the root component of one and attach it to the root component of the other specifying the socket name. Both actors only have StaticMeshComponents, so the root component of each is the StaticMeshComponent I believe

The both boxes do snap together, one box snaps using it pivot point and the other snaps using its socket. I would love to know if you can snap 2 boxes together using each of their sockets.
You can snap together but only using one socket from one box, there is not an option that says attach box 1 socket to box 2 socket.

This is how it works, if you want the mesh to rotate around the socket instead of the root is quite simple. You can offset the second mesh by the relative location of the socket after attaching.

Thank you for the reply KieranChandler but there is only one socket option on the AttachToActor. The other mesh it just attaches using its pivot point.

Ahhh I got it, thanks for the clarification! So “sockets” are really more like an offset translation you can put something into, like a Hand that can hold a gun, sword, apple, whatever. A solution to your problem might be to adjust the pivot point of object being placed, so the pivot is always at the bottom, and the socket is always the top, this would make things stack correctly all the time.

Another option would be to Attach the actor to a component, and then set a local offset on that component based on what is being held. This would allow something larger to stack properly, if you didnt want to be moving the pivot. You could move Box 2 to target location, offset by the location of Box 2’s socket, and then attach Box 1 Actor and keep location world relative. Just some ideas, hope you figure it out!

Ok, thank you for the reply and for the workarounds. It would be nice if unreal added a attach socket to socket.

Ok, thank you for the reply and for the workarounds. It would be nice if unreal added a attach socket to socket.