Hi there,
Currently im working on a Item system for my game and i want the character to be able to pickup and drop items at the moment, i do this the following way,
My Item is a blueprint based on (c++)MyItemClass which is based on AStaticMeshActor, and i have 1 blue print per every item.
when Item is picked up, i add it to the Players inventory and then i set the Items StaticMeshComponent->SetStaticMesh(NULL);
when the player drops the item, i set the Items position to front of the character and do StaticMeshComponent->SetStaticMesh(Mesh); (i assign Mesh in Item::BeginPlay() by doing Mesh = StaticMeshComponent->StaticMesh)
is there a better way of doing this? will this impact the performance in any way?
I’ve tried to do StaticMeshComponent->DestroyComponent() when i pick the item up , but i have no idea how to recreate the StaticMeshComponent once i drop the item , and how to get a functioning reference to the original static mesh, the item is using.
I’ve tried to follow quite few tutorials on how to create a StaticMeshComponent on runtime, but i either have a problem getting the original mesh, or the item doesn’t appear in the world.
Any help would be much appreciated