Attaching a static mesh to the second skeletal mesh on the player

Hello there, okay so im getting way out of my depth here but the best way to learn is throw yourself in at the deep end right?
Okay to the problem… i have a weapon static mesh. (JNG90) and i have a system in place to attach it to the socket on the third person mesh. Im trying to have this game so that when you hold the RMB, it switches to first person. Ive done this by adding the skeletal mesh from the FPS template of UE4 to the third person project im working in. Ive then managed to get that into the character BP and simply added a toggle visibility on the two meshes when RMB is pressed and released. Besides the point. I have a socket on the third person and a socket on the 1st. When i try to attach the weapon to the socket on the second FPS skeletal mesh, it adds itself instead to the floor of the third person, not in a socket just like, on the floor at what i guess is 0,0,0.

Any ideas how i can specify which mesh to attach it too? Hopefully the images help explain my point.

Thanks

You can use Attach Actor To Component blueprint node.

In your graph of your blueprint, simply use that, with the target being your weapon, and the component being your selected Mesh.

You will also have to specify yur socket name and how to attach it to the component, in your case, I’m guessing it would be to Snap to Target.

31440-attachactor.png

Hmm, it would seem that i’m not actually able to connect the mesh for my weapon to that target slot… am i adding the weapon wrong?

It would seem you have some concepts to learn :slight_smile:

Here we go:

An Actor and a Component is NOT the same thing.
The Actor can be seen as the Container, while a Component is something you put in it. Basically, a component is always part of 1 actor, while the actor can have multiple components.

What you are trying to do in that picture is use a Component (a static mesh component to be exact) as an actor. It’s not going to work. Fortunately, there is also a node to attach a component to a component!

Basically, when you use Attach Actor to Component, you are actually linking the component to what is called the Root Component of the actor. So in theory, you always connect components to other components.

To do what you want, use the Attach To node.

31476-attactto.png

Sure, it’s the Destroy Component node. I recommend this serie of tutorial for you :

It helped me a lot in the beginning!

Don’t forget to re-accept the answer, commenting on it actually remove that.

Lol yeah i do have a lot to learn still :’) thank you for explaining that however the Attach To node is one i was already using but, having just gone and tried it, i wasnt specifying the correct mesh to attach it too so yeah i got there in the end but as for the explanation about components and actors, that’s helped a lot so thank you for that. Ill mark this as answered but whilst im here, i dont suppose you know how to delete a mesh from a socket, as in totally remove that mesh from the game not just from the socket?

Thanks anyway!