Considering there is no pre-existent function to compute the screen bounding box of an actor I decided to script it on a blueprint by myself.
I will give a simple summary of the process, these are the steps I’m taking for all the actors visible in the camera frustum:
-
Get the actor bounding box (Get Actor Bounds)
-
Compute maximum and minimum x and y in screen space, to get a starting bounding box that I know includes the actor on the screen
-
Starting from the middle of the starting box, I perform a binary search using a Multi Box Trace For Objects. If I get a hit, I look closer to the edge of the starting box. Otherwise, I look more to the center. I stop when the projection of the world position to the screen improves by less than a pixel (or when I reach a maximum amount of steps).
This last step is performed in all 4 directions but for sake of simplicity I will show you what I get for maximum X only.
As you can see my box trace (which has dimensions 0.001, 0.001, 150.0 and starts from the camera origin) hits random points in the scene, although the actor has no collision geometry in that area (I’m registering hits with said actor only, ignoring anything else).
Actor’s collision preset is BlockAll and Per Poly Collision is enabled to get accurate hits.
Any idea why that happens?
Is it a known bug?
Might it be because I’m performing all those traces for all actors during the same game tick?

