Finding the Closest Actor to a Given Vector and/or Rotation

pretty much! It should be a lot of the same logic with different values. You just iterate (loop) through all of the actors and filter them based off of their criteria. You can do this in one pass.

You loop through the list of actors and if the dot product is greater than 0 (or maybe whatever your fov is), then you can save a reference to that actor in a local variable along with the distance between that actor and the player if you’re measuring a valid target actor in that regard. But if you’re trying to figure out what actor the player is staring at the hardest (if it’s more in the center of the player’s view), then you choose the largest result of the dot product and return that actor that is paired with that result. And if that’s the case, you likely don’t even need to do any line traces which will save you heavy on computational power. But go for functionality first and then worry about optimizing it after!