Weapon not attaching to socket

When you start the game does it spawn where it should be, but when you walk away it just stays there?

so i attach a weapon to a socket and i build a blueprint setup for it but it doesnt attach here is the build

Here is the blueprint

Here is the actor and i already add a preview asset to the socket so did i do something wrong?

Heres the controller and it did not attach as i it to so whats wrong?

when i start the game it stays like this heres a pic

and seen from editor unplayed

the fps hand with the socket

So what is wrong?

Don’t do that in the construction script, do that in the Begin Play event isntead.

it stays the same

I would suggest making the weapon be root, eliminating defaultsceneroot. It rings a bell that this doesn’t work correctly without doing so.

You meen make root of the gun like this right?

if it is like that its still not working

Help me solve this please

Hello, is this problem solved? I also have the same problem when trying to attach one actor to another, it’s only snapped when the game starts, but when the human character moves, the should-be-attached actor doesn’t follow the human character.

I am having this same problem! All the documentation on this is quite dated, I’m wondering if things have changed in later versions of the engine.

My blueprint looks alot like yours, the weapons attach to the character, but not to the socket. The sockets look fine in persona, but they just won’t play along in game. :frowning:

94919-capture.png

I hit this on about 4.8 when I was doing my original attachment of weapon to FPS player, then I hit it again just a couple of weeks ago when attaching a “shadow” weapon to the third person shadow generating mesh. The symptoms are, after AttachToComponent, the weapon appears to be in the right position, then the player walks away and the weapon stays there.

The original issue was due to having a DefaultSceneRoot as I put in the answers. That was not what caused the issue with the shadow mesh I was attaching. Unfortunately my latest example of the problem was all done in C++ so that won’t help you and I just messed with it until I got it working (don’t remember for sure), but the issue was the snapto enum I was using (I think). Since you don’t specify that on the Blueprint version of AttachToComponent, it’s not the same. On the Blueprint version I am using for the base weapon, it’s using “Snap to Target” for both Location and Rotation rules, and Keep Relative for the Scale rule, then “Weld Simulated” is ticked. I also have a “Set Collision Enabled” set to No Collision just prior to doing the AttachToComponent.

It might be useful for one of you to post not only the component list/order but also the blueprint blocks you are using to perform the attachment. One other issue is that attachment changed recently so there are different functions depending on version of UE4.

I’ve attached my blueprint.

I am attaching a BP to the character blueprint. This blueprint is located in the hammer (which I am attaching to the character). When I have the hammer in the level it moves to the character (as you can see in the previous attachment) but doesn’t attach to the socket.

Unlike the OP, if my character moves the shield/hammer follow it.

I observed the same thing at one point when working on the weapon->FPSMesh. The weapon was hanging out in space and would move with the character, but wasn’t seemingly connected to the socket. I don’t remember how I fixed it, but here is the graph I’m using and collision may have been a factor, but it also may have been the timing of components being fully initialized when the attachment occurred. I’m using a custom event that fires long after beginplay.

For some reason, I can’t upload my snapshot of the blueprint (it keeps saying no such upload). I am using (in 4.12) AttachToComponent (AttachToActor was deprecated), Target is my weapon, Parent is “SceneComponent” Cast from my Mesh object (that has the socket). Collision is turned off with “Set Collision Enabled” for the weapon mesh just prior to performing the attachment. Unfortunately, the other part is in C++, and that is where I set the Parent of the Weapon Blueprint to be the Character Blueprint and then call my custom “Equip Weapon” event.

Here it is as a jpg.

Sorry for the necro, but I wanted to post in case someone else ran into this thread.
Eagle’s post helped solve my problem. I was attaching my actors to the RootComponent of the player character, while I was meant to attach them directly to the Mesh.
For all other newbies going through this, double check what you’re attaching your weapons/items to!

1 Like

You probably need to do a get child component on your gun or your character. Then link it to attach.

Ive managed to crash the engine hundreds of times doing this.

For mine I did this. However it didn’t work for my projectile attaching to my gun muzzle socket. For that I had to get child actors.

Heres my others. Very confusing. I had to manually align the shells