Attaching Weapon Actor to Weapon Component

Hello!

I’m new to Unreal Engine and am currently messing around with 5.4.1. I’m attempting to equip a weapon blueprint where I’m (trying) to house my damage system for the gun (specifically a pistol in this case).

I was able to attach a Static Mesh to the hip (socket named Holster), and then through an input action attach it to a socket on the hand (socket named Gun) and then be able to return it to the Holster socket.

The problem I’m encountering is this:

  1. When I use the Spawn Actor of Class and Attach Actor to Component, the pistol spawns on the floor and doesn’t move and not in the hand (Gun socket).
  2. The pistol on the hip (Holster socket) doesn’t disappear like it does when doing the Component to Component connection.

Image of the BP where I’m trying to do this

Hello, you need to connect the output pin (“return node”) of the SpawnActor_BP_Pistol to the “target” pin of the ATTACH_ACTOR_TO_COMPONENT node.

Assuming the MESH is the correct parent, and that it contains the socket “Gun”, you would connect the MESH node’s output pin to the input pin of the ATTACH_ACTOR_TO_COMPONENT.

Basically, it appears you have the roles reversed.

Oh perfect!

Thank you so much for the help!

How would I go about making the component disappear from the hip bone when the actor spawns? Originally when using components the pistol would detatch from the hip socket (Holster). Now since I’m using an actor, the static mesh of the pistol stays on the Holster socket.

I’m not entirely sure what you mean by this. Do you mean that there is a “prop gun” and a “shooting gun”? Where the “prop gun” is always holstered, and the “shooting gun” is always animated?

If so, you can toggle the visibility of your “prop gun” by dragging the reference to it from the side panel of your blueprint, and pulling from the output pin the node SET HIDDEN or SET VISIBILITY.

An example is below:


1 Like

Sorry!
Let me try asking in a different way now that I’m more caffeinated…

How would I go about attaching the BP_Pistol to the Holster socket prior to equipping, then after equipping and unequipping and equipping again have it not appear in the Holster socket? Because currently it doesn’t appear initially until it’s equipped, then when unequipped it appears on the hip as expected. After re-equipping it’s now both in the hand and hip.

I removed the pistol’s static mesh from the player character for ease.

I appreciate your help thus far!

1 Like

I think I understand.
Then I would do what I suggested, which is to add a “prop gun” that then inhabits the space of the “shooting gun”:

This “prop gun” would become invisible, and only the “shooting gun” will remain active/in sight.

1 Like