Attaching weapon actor to player?

Hi there. I’m having a problem trying to attach an actor to my third person character. It should be mentioned that I’m not interested in having it looks proper with socket connections and animations etc. I simply want to be able to place the actor when I’ve shown in first screenshot and have it with the character. However, as soon as I hit compile in the viewport screen, it instantly turns huge as seen in the second image, and stays in that same place. So therefore whenever I launch the level, as you can see, it is just a giant model in the middle of the map… even though it’s attached to the character BP. If anyone knows what the problem could be, I’d really appreciate the help!

Use AttachToActor Node, and in scale rule select “Keep World”.

Would I add that to the weapon’s BP? Also I need it so this isn’t permanent. Because I am going to have pickups that will make the character then hold onto the weapon only if they have the pickup. The default character will be just a normal character.

I tried adding that node, and it didn’t seem to make a difference

You and add it anywhere, but the parent must be the character and the weapon must be the target. This node will only work in runtime, once you don’t have actors before start the game. I don’t know exactly what you are trying to do, if you can give us some screenshots it would be amazing


Hi again. Sorry for being too brief. I’ll explain what I’m trying to do. I have made a gravity gun weapon that I’ve had to mess around with for third person use (was originally done in first person BP). In the full level I want the player to not start with this or any other weapon. Throughout the course of the level through obstacles etc, there will be pickups that give the player access to the weapons. So I will need to eventually build a inventory system however to start off I really just wanna test being able to hold the gravity gun with the third person character.

From what I can guess, in order to have the third person character hold the weapon, I will need to add the weapon as a child to the character BP, along with later having variables for stating if it’s been picked up etc. So I’ve now got the gravity gun as a child actor of the character as shown above. So when I try to move it to a position where it will just stay attached (without the proper use of binding to the skeleton etc) and when I do that, as soon as I hit compile, it doesn’t keep it’s correct size and positioning. So when I launch the game, it just sits in the middle of the map as I get the warning message saying “AttachTo ThirdPersonCharacter.GravityGun is not static. Cannot attach to PersistentLevel.GravityGun which is static to it. Aborting.”

So I obviously need to use this attach to node function somewhere, but I’m not sure where.

Not really. You can always have the static mesh available and set the visibility on/off when the player takes the gun. If you have multiple weapons, you can set the static mesh to the weapon you want. Look how I did this in a project I have:

It can be done fully in blueprint. FP_Gun is my UStaticMeshComponent. I used the beginoverlap, then always my main pawn hit an actor with that blueprint it will change the weapon. The static mesh component is always there attached to a socket.


Okay. So I’ve gone ahead and made that function on the actual character BP. So now on the weapon pickup BP, I am checking that the player has overlapped it and then casting to this new function. My question is on the character itself, what do I do about have a “weapon transform” variable. And what should that do so that I can attach it to the change weapon function?

Also, even with the child actor attached to a socket, it still seems to not work when compiling. I noticed it works if I just have a mesh component attached to the character, which would make it look fine. But the problem is I need the actual actor, because I want it so that when the character is holding this weapon, they can use it to pick up items, as I’ve set up in the script for the weapon. If the answer to solve this is that I just have to use a mesh, not a child actor, then can you please tell me how I’d allow it to use the weapon when it has it equipped.

Don’t use a child actor in this case, use a static mesh component. If you want to organize your code, create a separated graph to put the gun code. Why it should be a child actor?

I guess you will have advantages creating a pickup class instead of merging the pickup with the weapon itself. Just create a pickup class, and destroy it when player pick it up. When the player drop the weapon, set the gun mesh to none and spawn a new actor of pickup class on player location.

So the pickup “class” I have is what you can see in the first image I’ve attached. So I want it so that when you touch that pickup, you will then have access to the grav gun, but not before. It already destroys when the user picks it up, but I just don’t know how to deal with setting the mesh stuff to work as at the moment, it still has a huge scale and won’t attach to the character. On the third picture I’ve attached, you can see my third person character, where I’ve attached the actual actor of the gravity gun (with it’s logic and everything) to the character as a child actor. The reason for this is so that the character has access to the capabilities of the weapon. You ask why use the child actor. I’m not really sure how else I can make it so the character has access to the ability of using the gun.

You are thinking wrong my friend. You don’t need to attach the pickup to the player, the weapon should always be with the player, but only its mesh needs to change. Please watch this video to see what I am talking about:

Thanks so much for the help mate, I’ve managed to figure out the rest of it now. The only thing left I’m wondering is how I can use the system from that video of pickups, and also make a weapon switching system. So like based on whether I’ve picked up the weapons, I can change between them with the numbers on my keyboard.