Game Characters (1st, 3rd, enemy)

Simple Pick up tools/weapon



Create Tools/Weapon


Create BP actor called BP_Item (the tools be picked up)
Add static mesh and collision box (area that player able to trigger the pickup)
Make sure collision box preset as Overlap All Dynamic
image.png

Create a BP interface, called BPI_Items
Open it, rename the function as PickUp
image.png
Back to BP_item → Class Settings,
Add the BPI Interface
image.png
R click on Pickup, Implement event in the interface column, a pickup node is created in event graph:
image.png
image.png

Create Pickup on character:


go to 3rd person BP event graph
image.png

Test in scene if the tool destroyed/disappeared upon picking up

Create pick up item BP adoptable with different meshes


To BP_item, add variable Item model to place, make it public
image.png
Go to its construction script
image.png
Now the item meshes can be changed in Details when the BP_item dragged in scene:
image.png


Equip the tools/weapon


Go to 3rd person viewport, on character mesh, add a static mesh called EquipedItem
image.png
Parent socket on R hand, fine tune its position in palm
image.png
add cast to bp item and following:
image.png
To BP Item, add the node below
image.png

Create socket on player hand (for better position of equipped tools)


Open the player mesh skeleton,
Skeleton tree → Hand_r (R click, add socket)
image.png
Name as itemSocket
R click on it ,add the sword for preview
image.png
Position it in palm
image.png
Add different socket for each tool/weapon for precise grabbing position
(rename original one as weaponSocket, added one as CylinderSocket)

Back to 3rd person BP, change the parent socket to item socket
image.png
Reset location and rotation to 0,0,0

Go back to 3rd person, in view port, duplicate EquipedItem component, name as cyldinerItem, add cylinder socket
image.png
In graph, add branch and:
(set nodes that can adopt more than 1 socket)
image.png

If having more than 2 tools, add more branch:
image.png
For 3 tools, etc:
image.png


Add anim to make tools shrink before disappeared:
to BP_item event graph:
image.png
double click timeline node, float value, name as ShrinkTimeline, length set as 0.30:
image.png
R click on the curve, add 1st keyframe, set as time, value as 0,0
add 2nd key, same time 0.30, value 1
image.png
Back to event graph, add follow nodes from Shrink timeline output just created:
(Lerp node is for run slowly of value from one to another one)
image.png
add sound during pickup
image.png
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.