Getting Best Interaction Actor From an array

I have children of Actor called BP_Interaction_Master which have a static mesh a collision sphere and a widget component (set to screen and hidden).

When the player get’s within the collision sphere the actor gets added to an array Called Interaction List, and when they leave the collision sphere the actor is removed from the array.

I have been trying to figure out how to take where the camera is looking and sort through the array to find the index of which actor the camera is looking closest to. I have gotten fairly good results, but far from perfect.

Here are my results so far, the system currently doesn’t track which result is best, but the last result that works. I’m not sure how to find which is the best of the successful tests and get it’s index specifically. I’m also not sure how to handle choosing between items that are lined up infront of the player, the system will always choose the item that is closest to the camera rather than closest to where the camera is looking.


Here is my Blueprint that sorts the array it is quite large so I’ll link it

Hey man.
I dont remember exactly, but there is a tutorial on Youtube that makes what you are trying… search for “Lets make interaction System”… if you dont find i can get you the link later. Basically it uses a Product between the object position and the camera to detect the best interactable.
I hope it helps!!