You keep saying direction, but then mentioning that the rotation doesnt matter.
Thats because what you acrually want is the location.
You want a look at - to the actor to be chosen.
Alternatively, if you socathoa it, then something like Dot will give you the + and - you need to determine everything. But, you have to base your math on the result of the main actor forward vecor and the other actor Locations (not rotations).
There is technically no need to line trace, or anything, except for math and knowing your trig.
But… you can’t relay on a loop for this to work either since unreal engine and loops dont really jive.
I would suggest this as a pseudocode/setup:
Add a collider to the main acotor (a cylinder) in the size you want to scan objects for.
Add an event to the actor. Get all actors (of class) within the collision of the cylinder (use sweep).
Check how many actors there are - if more than 10, you have to make something that is async or not on the game thread or the loop will probably fail.
If less than, you do the maths and store the result to a soft variable of type actor (so you store a ref to the closest actor).
As the loop progresses, only the closest actor is stored up for you - and you can further code up ways to manipulate “who” is closest, or if they are facing behind or in front of the actor’s location, etc.
The limitations to this are the number of actors involved.
But you can also restrict that by making your collider a different shape or size, or chaning the collision channels for the actors so as to only have some respond.
You can’t have the loop do crazy maths though - like look at is altready expensive as it is, so go with the sinpler things whenever possible.
The real reason blueprint loops fail is that it’s thread blocking, and therefore a large delay will cause the engine to claim the loop is infinite…