Lock-On System Target Switching with Analog Stick

Hello everyone, I’m working on a 3rd person Lock-On system similar to what you would see in a fromsoft game, or kingdom hearts. I’ve got most of everything working so far except for target switching with the analog stick. I would like to be able to navigate between the enemies using a vector 2 from the stick, meaning I could pick an enemy in the direction I am moving the stick in based on how they are currently seen on the camera in an intuitive way. Here’s how I see this working in my head:

Given this scenario

I should be able to map the positions of these objects on a 2d plane relative to how they are perceived in game, here’s an approximation of how this scenario should look like when mapped onto the 2d plane:

(Note: I just realized, but the orange and purple circles should swap X coordinates)

Then I should be able to use my analog stick to switch my target to the closest enemy in the direction of my input, similar to how unity’s UI auto navigation works

Here’s another example to show why it’s important for this system to be camera relative

I would appreciate any help I can receive with this, as well as any alternative solutions to this problem. This is how I thought something like this should work, but if there are any simpler solutions feel free to point me in that direction as well.
I’m mostly looking to know how I can map the objects onto a 2D plane as described, everything else I’ve got figured out I think, thanks in advance!