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?
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?
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.
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?
The reason this doesn’t work must be one of two things.
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)
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.
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)
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.