first we want to get the other Actor
s transform
GetActorsOfClass
(which is kind of slow as it has to sift through everyActor
in theWorld
),- throwing like a Sphere Trace into the world on a key press, but this has the issue of the game window not being a circle, and takes no account for the angle of the sides, top, and bottom of the frustum.
- A manager (that exists to hold all the
Actor
s you will actually care about, introducing the overhead of needing to store say aTArray<[MyPawnClass]>
, and thoseMyPawnClass
needs to be registered somehow, but the list just exists when we need it), - Technically the most expensive middle ground being put a collider on the
Player
that only interacts with the things we care about (this would require playing around with collision channels, and is limited to Isometric perspectives like top down, or side view) - For other perspectives especially where the camera can rotate put the collider on the Camera itself ( this would probably require rolling your own collider to mimic the behavior of a frustum and would need to be modified if say the zoom level “needs to”/“Can” be changed)
The collider method is the simplest as no math is needed just managing the OnBeginOverlap
and OnEndOverlap
but has the cost of taking up collision channels, the feedback being on the During_Physics_Tick_Group
, and having the engine need to be monitoring the collider for the overlaps.
for the Manager or the GetActorsOfClass you can look here Perform Frustum Check there is a C++ and a blueprint implementation that both look promising.