How to attach gun to right hand?

Hey all, brand new to UE5.

I have a little bit of blueprints set up to play this “idle_rifle” animation once my character picks up a gun, and it works well. Problem is that gun isn’t attached to the character’s hand and is instead floating above the ground. The gun will follow me where I move, it’s just not attached to my hand. How can I attach the gun to my hand?

Hey @Apple43YT!

When you do your attachment, you need to specify the socket and Snap to Target! Can you show us the code you’re using to attach the gun to your hand?

Get back to us with more info soon! :slight_smile:

Sorry for late reply. I’m just using UE5’s default weapon_component blueprints with a little extra I got from a mizzofrizzo tutorial. Anything wrong here?

if u have time u can see this video

If multiplayer…
Spawn the weapon (Replicated Actor) on the server and attach it. Use Attach Actor to Component.

I agree with Rev, I seem to have more luck attaching when I use attach actor to component then the other attach actor to actor. In this case actor would be the weapon and component would be the mesh of your character. And I would also suggest going into the skeleton of the character, choose the right hand and right click and make a socket. Then you can right click on that socket add a preview mesh of the weapon and position, rotate, and scale it accordingly, thus when you attach and use that socket (snap to target) it will look just how it looked in the preview mesh.

If the weapon is a component in the blueprint tab…meaning its a base component of the character, use Attach Component to Component.

Otherwise its an ACTOR class (blueprint, C++) that’s not a part of the character class, use Attach Actor to Component.


I have the gun preview and hand socket set up the way I want it to, but it doesn’t carry over to the game preview.

I am trying to figure out how to implement Attach Actor to Component, like you said, I’m just not sure how to implement it without getting error messages. Thoughts?

1 Like

The reason this doesn’t work must be one of two things.

  1. You entered the socket name wrong (fairly certain it should just be hand_r not hand_rSocket, unless ur using a custom socket i suppose)
  2. Location rule should be set to snap to target, by keeping it relative it stays in the location it is relative to the model when it was attached. Rather than snapping to the socket.

This works for me for instance:

As you can see though, attaching it is only the first step, then there are collision issues (not as big of a deal for firearms, but you can see the collision issues with the sword, where it’s colliding with the mesh and pushing it in my video) and getting it to the right exact location and orientation is another as well.

There are many ways to deal with all these problems, but I haven’t gotten around to it yet.

If your sword has it’s own blueprint and is a separate actor, I strongly advise you to use attach actor to component rather than attach component to component, because by doing the latter you’re taking just the mesh out of the blueprint leaving an orphaned blueprint floating around in your game world needlessly (although that problem can also be solved by just destroying the blueprint after the weapon is attached)

You can make sure there is not collision or physics on the weapon conflicting on the attach, what does the error say?

usa: I’m using Attach Actor to Component in the exact same way I was using Attach Component to Component. The errors for both of them read: “This blueprint (self) is not a Actor, therefore ’ Target ’ must have a connection.”

Cestarian: I should’ve specified, I did make a custom socket as a child of hand_r and left it titled hand_rSocket.