Accessing the position of the editor viewport camera

After a few hours of trial and error I finally found a working solution:

auto world = GetWorld();
if(world == nullptr)
     return;

auto viewLocations = world->ViewLocationsRenderedLastFrame;
if(viewLocations.Num() == 0)
     return;

FVector camLocation = viewLocations[0];
4 Likes