Skip to content

Equipment system

The equipment system puts an item in the character's hands. Selecting an item spawns its actor, attaches it to a hand socket, links the item's overlay poses (third and first person) and updates the hand IK targets. Items are described by data assets, so adding one needs no code.

Folder /GASPALS/Systems/EquipmentSystem
Component AC_EquipmentSystem (on both pawns)
Interface BPI_EquipmentSystem (what other systems ask about the held item)
Data Data/PDA_Equipment (class), Data/DA_Equipment_<Item> (one per item), Data/CHT_Equipment (chooser), Data/Enum_Equipment (slots)
Actors Actors/BP_Equipment_<Item>
Meshes Assets/Meshes (M4A1, M9, Bow skeletal meshes with their skeletons; Torch, Binoculars, Box, Barrel static meshes)
Menu Widgets/W_Switcher_Equipment, Widgets/W_Button_Equipment
Input IA_Equipment: T or gamepad RB (hold for the menu); IA_Select_Next / IA_Select_Previous: mouse wheel or D-pad up / down to choose
Settings Equipment reference

Included items

Slot Actor (mesh) Third-person overlay First-person overlay Attach socket
Unequip none The selected overlay stance (ABP_Overlay_Default unless changed) none none
Rifle BP_Equipment_Rifle (M4A1) ABP_Overlay_Rifle ABP_OverlayFirstPerson_Rifle overlay_rifle
Pistol BP_Equipment_Pistol (M9) ABP_Overlay_Pistol2H ABP_OverlayFirstPerson_Pistol2H overlay_pistol
Revolver (hidden from the menu by default) BP_Equipment_Revolver (M9) ABP_Overlay_Pistol1H ABP_OverlayFirstPerson_Pistol1H overlay_pistol
Bow BP_Equipment_Bow (Bow) ABP_Overlay_Bow ABP_OverlayFirstPerson_Bow overlay_bow
Torch BP_Equipment_Torch (Torch) ABP_Overlay_Torch none overlay_torch
Binoculars BP_Equipment_Binoculars (Binoculars) ABP_Overlay_Binoculars none overlay_binoculars
Box BP_Equipment_Box (Box) ABP_Overlay_Box none overlay_box
Barrel BP_Equipment_Barrel (Barrel) ABP_Overlay_Barrel none overlay_barrel

The rifle, pistol, revolver and bow are skeletal meshes whose skeletons carry HandIK and ADS sockets (the pistol and the revolver share the M9 mesh with two different poses: two-handed and one-handed). The bow animates its string while you aim (Bow_AnimBP, driven by the actor's Draw value). The others are static meshes; only the binoculars have a HandIK socket.

The revolver is not polished yet, so it is listed in Hidden Equipment and does not appear in the menu. It still works when selected from Blueprints. To bring it back, remove it from Hidden Equipment (see Settings).

How it works

flowchart LR
    Sel[SelectedEquipment<br>Enum_Equipment] --> Ch[CHT_Equipment<br>chooser]
    Ch --> DA[DA_Equipment_Item<br>PDA_Equipment]
    DA -->|Overlay Pose TP| L1[LinkAnimClassLayers<br>third-person mesh]
    DA -->|Overlay Pose FP| L2[LinkAnimClassLayers<br>first-person meshes]
    DA -->|Spawned Actor| Sp[Spawn actor<br>attach to socket]
    Sp --> IK[UpdateHandIK<br>IK_* transforms]
    IK --> ABP[Character Anim Blueprints<br>CR_Humanoid_HandIK]

At start, the pawn hands the component its meshes (InitializeSystem, called from the pawn's Equipment_Initialize; see Add the systems to your own pawn) and the starting item is equipped.

When Selected Equipment changes (UpdateEquipment):

  1. The previous item's actor is destroyed.
  2. CHT_Equipment turns the slot into its data asset. A slot without a chooser row falls back to DA_Equipment_Unequip (empty hands).
  3. When the data asset has a Spawned Actor, its Overlay Pose TP is linked on the pawn's third-person mesh. When it has none (Unequip), the overlay system applies the selected stance instead (see Overlay system). An empty Overlay Pose TP links nothing: the mesh keeps its layers and an orange warning names the pawn and the data asset. The Overlay Pose FP is linked on the first-person meshes; an empty one resets the first-person layers to their defaults.
  4. If the data asset has an actor class, the actor is spawned (owned by the pawn) and attached to the visible third-person mesh at Attach Socket TP, with Attach Offset TP.
  5. The item's mesh components are attached to the visible third-person mesh (meshes tagged DoNotAttach are left where they are). If the pawn has a first-person system and the data asset's Create First Person Copy is on, the equipment system asks it for first-person copies of the item's meshes (CreateItemFirstPersonCopies on BPI_FirstPersonSystem) and attaches them to the first-person mesh at Attach Socket FP with Attach Offset FP. Before an item is destroyed, its copies are removed (RemoveItemFirstPersonCopies). Without a first-person system, the item still attaches in third person.
  6. UpdateHandIK computes the hand targets. It runs for every slot, so after Unequip (no actor) the hand IK transforms are reset instead of keeping the previous item's values.

The "visible" mesh is the one the player sees: the pawn's own mesh, or the retargeted character's mesh when one is shown (M), so items attach to that character's skeleton sockets.

Hand IK

Two sockets on the item mesh place the hands (names set per item in the data asset):

Socket (default name) Use
HandIK (Hand IKSocket) Where the support hand grips the item.
ADS (ADSSocket) The sight point, lined up with the eye when aiming down sights in first person.

UpdateHandIK stores six transforms (IK_HandLeft, IK_HandRight, IK_ADS and their _FP versions), each expressed relative to the hand that holds the item (Left Hand Bone / Right Hand Bone on AC_EquipmentSystem, default hand_l / hand_r), so they follow it. IK_HandLeft is the HandIK socket in the right hand's space (for items held in the right hand), IK_HandRight the same socket in the left hand's space (for items held in the left hand), and IK_ADS the ADS socket in the space of the hand that holds the item (the left hand when Is Left Handed is on).

The character Anim Blueprints (and the retarget and first-person Anim Blueprints) read them and run CR_Humanoid_HandIK. The hand IK weight comes from the overlay pose's enable_handik_l / enable_handik_r curves, so each pose decides when, and with which hand, the support hand grips. Items without a HandIK socket (torch, box, barrel) rely on their overlay pose alone.

The bow moves its sockets as it draws, so it updates the hand IK every frame.

Sockets on the character

The items attach to overlay_* sockets on the character's Skeleton (not on the skeletal meshes): overlay_rifle, overlay_pistol, overlay_bow, overlay_torch, overlay_binoculars, overlay_box, overlay_barrel. On the UEFN mannequin (SK_UEFN_Mannequin) they hang from weapon_r / weapon_l; on the UE5 mannequin (SK_Mannequin) and the MetaHuman skeleton (metahuman_base_skel) from hand_r / hand_l. Retargeted characters need them on their own skeleton (see Add a retargeted character). A missing socket attaches the item at the mesh origin, at the character's feet.

The menu

Hold T (gamepad RB): the world slows to Menu Time Dilation (0.35) and the Equipment Menu Widget Class (default W_Switcher_Equipment) opens with one button per Enum_Equipment value not listed in Hidden Equipment, labeled with the enumerator's display name. The highlight starts on the current item. Scroll up (mouse wheel up, D-pad up) to move the highlight up the list and down to move it down (it wraps at the ends and skips hidden slots); release the key to equip it. A new enum value appears in the menu automatically, unless it is added to Hidden Equipment.

The buttons follow the enum order: Unequip, Rifle, Pistol, Bow, Torch, Binoculars, Box, Barrel (Revolver, between Pistol and Bow, is hidden by default). To reorder the menu, drag the enumerators in Enum_Equipment (pins, data assets and chooser rows refer to them by name).

Hidden Equipment only hides slots from the menu: SelectNewEquipment and Selected Equipment still equip them. Use it for unfinished items, or for items a pawn should not offer.

The component owns the menu: it keeps the highlighted item (HighlightedEquipment), moves it on scroll and equips it on release. The widget only shows it, reading the component every frame, so a custom menu widget needs no calls from the component; read HighlightedEquipment (and SelectedEquipment) from the owning pawn's AC_EquipmentSystem.

If the pawn is destroyed while the menu is open, the component's EndPlay calls CloseEquipmentMenu: it removes the menu widget and sets the world speed back to normal.

Cleanup

When the pawn is destroyed, DestroySpawnedActors (bound to the pawn's On Destroyed) destroys the item actor.

Data asset fields

PDA_Equipment, in the Details panel of each DA_Equipment_<Item>:

Field Category Use
Spawned Actor Equipment > Attach Actor class to spawn. Empty for Unequip: nothing is held and the overlay system's stance shows.
Attach Socket TP / Attach Socket FP Equipment > Attach Socket on the visible third-person / first-person mesh.
Attach Offset TP / Attach Offset FP Equipment > Attach Transform relative to the socket.
Is Left Handed Equipment > Attach The item is held in the left hand (the bow): the ADS target follows the left hand.
Overlay Pose TP Equipment > Overlay Overlay Anim Blueprint linked on the third-person mesh (a child of ABP_OverlayPose_Base). Linked when Spawned Actor is set; without an actor, the overlay system's stance shows.
Overlay Pose FP Equipment > Overlay First-person overlay Anim Blueprint (a child of ABP_OverlayFirstPerson_Base). Optional: without one, first person shows the third-person overlay.
Hand IKSocket / ADSSocket Equipment > HandIK Socket names on the item mesh (default HandIK, ADS).
ADSEnter Speed / ADSExit Speed Equipment > ADS First-person aim down sights blend speeds for this item (15 / 5).
ADSHand Offset Equipment > ADS First person: moves the hands (and the item) toward or away from the eyes while aiming, in the head's space at the reference pose (0, 0, 0).
Create First Person Copy Equipment > First Person On (default): the pawn's first-person system makes a first-person copy of the item's meshes for the first-person hands. Off: the item is only seen in third person.
First Person Motion Profile Equipment > First Person First-person hand and item motion while this item is equipped (a PDA_FirstPersonMotion: DA_FPMotion_Rifle, DA_FPMotion_Pistol, DA_FPMotion_Bow, DA_FPMotion_Heavy). Empty: the pawn's default profile on AC_FirstPersonSystem. See Tune first-person motion.

Settings

On AC_EquipmentSystem (select the component in the pawn Blueprint). Both sample pawns use the defaults.

Setting Category Default Use
Enable Equipment Equipment > General true Read at start. Off: the pawn starts and stays empty-handed (Unequip) and the equipment menu does nothing.
Selected Equipment Equipment > Selection Unequip The item the pawn starts with.
Left Hand Bone / Right Hand Bone Equipment > HandIK hand_l / hand_r Hand bones the hand IK targets are expressed in. Change them for skeletons with other hand bone names.
Equipment Menu Widget Class Equipment > UI W_Switcher_Equipment The menu opened while T is held. Any User Widget (a custom widget should also skip Hidden Equipment).
Menu Time Dilation Equipment > UI 0.35 World speed while the menu is open. 1 turns the slow motion off.
Hidden Equipment Equipment > UI Revolver Slots left out of the menu (also skipped when scrolling). They can still be selected from Blueprints. Set it on the component of each pawn that should differ from the class default.

The rest of the component's variables are runtime state. With no first-person meshes (first person not in the camera's Allowed Perspectives, or no AC_FirstPersonSystem on the pawn), the first-person links and copies are skipped and the item is attached in third person only.

Using equipment from Blueprints

On the pawn's AC_EquipmentSystem:

Call Use
SelectNewEquipment(SelectedEquipment) Event: equip a slot. Call it on the machine that controls the pawn (see Networking).
SelectedEquipment The current slot.
SpawnedActor The current item actor (none when empty-handed).
EquipmentData The current data asset.
GetHandIK(SocketName, TargetBoneName, bIsFirstPerson) A socket of the item in a hand bone's space (identity without an item).

Other systems ask through BPI_EquipmentSystem, so they work (with "nothing held" answers) when the component is removed:

Interface function Returns
GetHeldItemHands Which hands hold the item (used by the CMC ragdoll to pick a get-up animation).
GetFirstPersonItemSettings The item's ADS speeds, ADS hand offset and first-person motion profile.
GetFirstPersonHandTargets The first-person hand IK and ADS targets, the handedness and whether the item has a first-person overlay.

GetHeldItemHands lists the slots by hand

GetHeldItemHands answers with a Switch on Enum_Equipment, one return per slot. A slot that is not wired there (for example a new item) answers "no hands", so the CMC ragdoll plays the default get-up. Wire new slots in it (see Add an equipment item).

Networking

Selected Equipment is replicated with a RepNotify, skipping the owner. The owning client sets it locally (and equips at once), then sends it to the server with one reliable Server RPC (UpdateSelectedEquipment); the server and the other clients spawn and attach their own copy of the item in the RepNotify.

Call SelectNewEquipment where the pawn is controlled: on the owning client, or on the server for the listen server host's pawn and AI. Because the replication skips the owner, a server-side call on a pawn that a remote client controls updates the server and the other clients, but not that client.

Limitations

  • The menu slows the whole world (also on a listen server host) while it is open.
  • The torch, binoculars, box and barrel have no first-person overlay pose.
  • The revolver is hidden from the menu by default (see Included items).
  • Changes to a data asset made while playing apply the next time the item is selected.