-
Create an event called OnHatPickup(AStaticMeshComponent* HatSM) on your player character
-
Call that inside the OnOverlapBegin function in your AHatPickup class
-
Inside the OnHatPickup function in your player class type:
if (HatSM) { HatSM->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true), FName("headSocket")); }