Attach weapon to actor

You need to create your socket in the player skeletal mesh by right-clicking the bone you want the mesh (palm usually works best) to attach too, then to be able to align the weapon (or any mesh) find the socket in the list (under the bone you selected) and right-click the socket and select “Add Preview Asset” and select the weapon mesh. You will need to do some adjustments of the socket rot/loc/scale in order for the weapon to look good.

Then, to get it to actually come into the game, you need to spawn the weapon into the world then attach it to the players socket that you just created.

A decent tutorial on sockets can be found in the docs here: SkeletalMeshSockets | Unreal Engine Documentation

Hope this helps! If so, I would appreciate it if you could accept the answer by clicking the check mark located under the arrow keys next to the answer. When done correctly, the answer will highlight green! Any other questions just let me know.

I have a character model that has the pose of a weapon being held, and the same on my enemy models. I also have my gun model as a static mesh. i want to attach my gun model to both models using sockets, but I can’t seem to find a way to go about this. any help would be greatly appreciated.

Ive got the sockets created no issues and the weapon preview looks good, but when I attempt the stuff in the docs it just does not want to play nice. I would like to use the permanent attachment method, but I can’t seem to make that method work the way the docs does it. Any suggestions?

In the docs it shows this as a method of permanently attaching the mesh to the other mesh, but all that does for me is add more previews.

And I am very new at all this, so blueprinting is out of my skill level, and no matter what I try I cant get it to correctly attach to the socket. I am using a player start node so anything else i try just seems to break it, I’m not sure what part of the entire project you want an image of. I want to attach a gun to 2 models, and have all instances have the gun. But I don’t know how to go about it. I just need a guide that details how to do that.

Basically, whats the simplest, fastest way to get the gun to appear in game without changing everything ive already got?

I would like to use the permanent attachment method

Not quite sure what you mean by that. Please explain

but when I attempt the stuff in the docs it just does not want to play nice
A picture is worth a thousand words. Let me see what you mean by not playing nice.

As far as I know, contrary to what that doc says, you can’t permanently attach a mesh to a socket via Persona. That method there is simply for preview. If you want a “permanent” attachment, then you should just create it with your mesh and make them 1 whole mesh (via blender or maya, whichever you use.)

To get the mesh to be in the world, you need to spawn the weapon into the world at game start. Immediately after the spawn, you attach it to actor and there you set the socket of the character you want to attach it too.

Watch this tutorial: Unreal Engine 4 Tutorial:Attaching a weapon or object to hand or socket - YouTube

While he doesn’t actually “spawn” the actor into the level, what he does works. However, for future use (especially for multiple weapons/characters) you should “Spawn Actor from Class” each weapon at Begin Play then continue with the rest of the code he has there (rather than using the “persistent” object in world.)

Here is another tutorial following the same methods but shorter: Unreal Engine 4 Tutorial: Attach to Socket (english) - YouTube

Again, these will work but consider learning how to spawn items for future use because you can’t get your Level Blueprint as a reference in any other BP than the Level BP so it makes it very difficult to work with “persistent” objects in the world and interacting with them.

Side Note They say that in Version 4.9 when it’s release, they will make it possible to reference your level blueprints but may still be difficult to do. I can’t say for certain until I’ve tested it.

1 Like

thanks, ill look into all that. This has all been a massive learning curve as I have only been using UE4 for a few weeks.

You can attach weapons permanently through the BP viewport of your character. Add a mesh component to your character in the viewport and then attach that new mesh(presumable a weapon) to the character by clicking the socket box in the details panel. The socket box will display a list of the characters bones and sockets.

1 Like