# Getting actors visible in viewport

**URL:** <https://forums.unrealengine.com/t/getting-actors-visible-in-viewport/1234079>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, editor, CPP, Blueprint, question\
**Created:** [July 19, 2023, 9:36pm UTC](https://forums.unrealengine.com/t/getting-actors-visible-in-viewport/1234079 "2023-07-19T21:36:27Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [July 22, 2023, 7:41pm UTC](https://forums.unrealengine.com/t/getting-actors-visible-in-viewport/1234079/6 "2023-07-22T19:41:32Z")

</div>

first we want to get the other `Actor`s transform

- `GetActorsOfClass` (which is kind of slow as it has to sift through every `Actor` in the `World`),
- 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 a `TArray<[MyPawnClass]>`, and those `MyPawnClass` 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](https://forums.unrealengine.com/t/perform-frustum-check/287524) there is a C++ and a blueprint implementation that both look promising.

---

_[View the full topic](https://forums.unrealengine.com/t/getting-actors-visible-in-viewport/1234079)._
