Closest enemy in a direction (left, right, forward, back)

Hello, if that arrow helps you just to know what’s in front of the player just use GetActorForwardVector, if not, I can’t give a clear answer on that side.

To know what’s in the front of the arrow or what you are using for the direction, you could do a raycasting to find targets and see which one is the closest one

Simple logic for Raycasting:

  1. Get Actor Location (Start Point).
  2. Get Actor Forward Vector, multiply by desired distance, add to Start Point to get the End Point.
  3. Line Trace by Channel with Start and End Points.
  4. Branch (to check if the line trace hit something).
  5. Break Hit Result (to access hit details).
  6. Perform your logic based on the hit (e.g., check if the hit actor is an enemy).

Further adjustments may be needed to make it work, hope it helps :slight_smile: