[Unreal] Weapon Slot: Pick up a weapon

Open the character static mesh window - select the mixed space mode - select the bone tree option - find the hand_r bone node
insert image description here

Right click - add slot, rename it weapon

insert image description here
insert image description here

Preview: Right click on the weapon node - add preview assets - select the corresponding weapon
insert image description here

The approximate position of the weapon can be adjusted in the preview. (but not actually displayed, only preview)
insert image description here

Create a new Actor blueprint "weapon" - add corresponding weapon components to this blueprint
insert image description here

Open the character blueprint - right-click to create a new Spawn Actor "Generate Actor" - select the weapon blueprint weapon for class, and choose to ignore collision for collision. - Next assign the slot change value
insert image description here

The weapon socket belongs to the character mesh, so drag the mesh to create a new mesh key - drag the mesh key to create a new socket "get socket change" function - In Socket Name select the socket name, Transform Space selects RTS Actor - the function is connected to the SPawn Transform that generates the Actor

insert image description here
insert image description here

This only creates a weapon socket, but is not bound to the character.
Drag and drop to generate the Actor execution pin, create a new Attach and "attach the Actor to the component" - the mesh key is connected to the Parent, the Socket Name fills in the slot name, and the following three options "Align to the target"
insert image description here

Complete below. The trigger event is played at will.
insert image description here
insert image description here

After running, it is found that weapons can appear in the slot, but the character cannot move forward, which is caused by the collision of weapons.
Open Weapon Blueprint - Details > Collision > Collision Presets > No Collision
insert image description here

This completes the process.

Guess you like

Origin blog.csdn.net/Zhanganzhen/article/details/124652476