Hi guys,
My question is about pick up item like RPG game
For example:
In Scene a player found some item and wants to pick up,
A hud shows “Press ‘Action Key’ for pick up” and pressing Action Key this item is added in his inventory.
But this is only possible if the player is looking at the item
I found this event “ReceiveActorBeginOverlap” for physics objects, but only works if Character overlap colliders
[UPDATED]
I found another solution with Raycast in Tick Function
FHitResult rayHitResult;
UWorld* World = GetWorld();
if(World->LineTraceSingle(rayHitResult, WorldFVectorStartPosition, WorldFVectorStartEndPosition, ECC_WorldStatic, TraceParams))
{
ActorItemWaiting = *rayHitResult->Actor;
}
and in BindAction function for Action Key
if(ActorItemWaiting != NULL)
{
AddOnInventory(ActorItemWaiting);
}
is this a best solution?