How do I detect when an actor enters the camera?

What I’m currently doing:

The camera collision channel doesn’t seem to ever trigger for overlaps, so I made a custom camera component where a collision box is attached to it (this is a top-down game so the view won’t change in any significant way to warrant more complexity), sized to the current screen resolution.

While actors do get sensed in overlaps with this method, there are two problems I can’t seem to get around:

  1. There is no way to view the collision box–it’s a UBoxComponent with Hidden in game unchecked, but it’s still hidden (no matter what size it is and how thick I make the lines). This makes it super hard to debug.
  2. Things that are already overlapping with the volume on BeginPlay() don’t get the overlap enter/exit events. Even when I change its box extents during runtime with bUpdateOverlaps = true, there are still no events occuring. I have to manually scale up the extents by an arbitrary number during tick until it gets to the size I want, but that seems non performant.

Is there another way to go about this?

You can use the DeprojectScreenPositionToWorld method in APlayerController to find the 4 corners of your screen in-world.
With that you can create a box and see if the actor’s location is inside that box.
For that you have IsPointInBox from UKismetMathLibrary

You don’t need to test collision with this, just positions in the world.

I found Project World Location to Widget Position works best - if there’s something better I’m not sure.

image