The way I think of picking up and carrying an object is have a component on objects that are able to be picked up and moved and a component that gives the player the affordance to pick up, carry, and possibly use objects. The events would have to be public to communicate between the Actors. You can call the component on the objects in the world Pickup, and the player’s component Holding to make the understanding easier.
I would not use a component for this simple task. Because if I had to place many chairs, the game will need to call twice as much (Chair+component).
So, i’would:
-
check for collision with Player
-
if there is collision, attach the chair to him. Using AActor::AttachToActor maybe?
-
I would check the ID of the object using Getname(), like we used in the UE_LOG
-
The game object i’d work with is AActor*