(SOLVED) Hello there lovely people at Game Dev. I am trying to Incorporate the inventory system and the pickup system. All i wish to achieve is the effect seen in the “Survival Game” From GitHub. I wish to have the weapon be picked up from the trace line and then go into the characters hand or back, the issue i am having is that instead of the weapon spawning at the socket on my character is spawns in the middle of the world/Map. Can someone please help?
I'm not sure what is going wrong here. There is a video showing my problem in the link below to my game dev page.
This Video is short. I will appreciate all the help i can get, have been trying to work on a C++ only inventory for weeks now. :/
This Code Below i thought would explain my issue but it doesn't.
My compiler shows no errors either.
void AArtifact::AttachMeshToPawn(EInventorySlot Slot)
{
if (MyPawn)
{
// Remove and hide
DetachMeshFromPawn();
USkeletalMeshComponent* PawnMesh = MyPawn->GetMesh();
// This Get's the Inventory socket name for attachments to match with the inventory socket
FName AttachPoint = MyPawn->GetInventoryAttachPoint(Slot);
Mesh->SetHiddenInGame(false);
Mesh->AttachToComponent(PawnMesh, FAttachmentTransformRules::SnapToTargetNotIncludingScale, AttachPoint);
//Mesh->SetupAttachment(PawnMesh, AttachPoint);
}
}
I'm doing this for my own learning purposes.
SOLVED NOTE: I solved my problem by adding in the Cpp files for the AddWeapon and RemoveWeapon functions found in this game. it was the one thing i failed to implement ?