Visualizing Item

To visualize equipped item EquipmentComponent is using separate blueprints (DisplayedItem), which are connected with item blueprints through interface I_ItemIsDisplayed.

DisplayedItem blueprint has few methods with basic functionality which can be overridden if needed.

  • Attach - attaches displayed item to owner's mesh
  • GetAttachmentSocket - returns socket to which displayed item should be attached
  • SimulatePhysics - enables or disables physics on displayed item
  • GetPrimaryComponent - returns primary displayed item mesh (e.g for sword it would be sword static mesh)

It also has 3 variables (EquipmenComponentReference, ItemType, SlotIndex) which will be set by EquipmentComponent, so don't set set them manually.

As an example let’s take a look at DI_Hand.
It is base class for every item that should be equipped to hand (shield / sword / bow etc.).

It adds new variable HandAttachmentSocket and overrides GetAttachementSocket function.

Whenever owner is in combat or slot is hidden, used attachment socket will be HandAttachmentSocket, otherwise it will be AttachmentSocket.

Additionally it assigns an event to OnSlotHiddenChanged dispatcher from EquipmentComponent, which will reaatach item whenever slot hidden changes.

Example of that may be when shield is equipped to hand, but new two handed weapon was equipped, then shield should be reattached to side or back.