Interaction System and Pick up objects issues

I’m having a problem with an interaction system I’ve implemented from a YouTube series. Whenever I’m trying to pick up an item and destroy the actor, I cant interact with any other item that I am overlapping.

For clarification, lets say I have two items and I have overlapped my character with both their collision spheres. The system adds these two items to a list and checks if the forward vector of the character is close enough to the vector between the character location and the location of the item (using dot product). It then chooses the optimal item and allows the player to interact with it.

If I set the interaction to just print a text, I can easily interact with one item, rotate my character and interact with the other. If, however, the interaction deletes the item (or disables its collision sphere), the other item becomes un-interact-able, as if I left the collision sphere. Id have to move away and reenter the collision sphere of the second item in order to be able to interact with it again.

I have here the URL of the video that provided the tutorial on how to implement the system. I would really appreciate it if anyone can explain as to why I may be having this problem. Thank you!

Hi @LoganDolan,

You mentioned that there’s a bit of code that checks which of two items is closer to the player and allows the player to interact with the closer item. When is this code run? If this detection code only runs once at the beginning, then it might be that when you delete the first item which you were interacting with it still returns it as the nearest item and the second item will not become interactive. Maybe you need to run this detection again after deleting any item, so that it’s aware of the newly deleted items and chooses the next nearest item. Hope that helps.

the code is run when the player overlaps the collision sphere of the item, which adds itself to a list inside the character player. Most of the code happens within the ThirdPersonBlueprint as functions that interact with one another.

What I dont understand is why is the list emptied when one actor gets destroyed? but nothing changes if the interaction does anything else but alter the collision sphere of said interacted item?