Getting editor viewport camera?

Given an editor viewport, ie.


How can I access the current camera associated with it, to be able to get information like current camera world position.


Nevermind, got it!

FEditorLevelViewportClient* client = (FEditorLevelViewportClient*)GEditor->GetActiveViewport()->GetClient();

Do you know if it is possible to get the editor camera location using blueprint?

In 4.17:

auto Client = static_cast(GEditor->GetActiveViewport()->GetClient());
if (Client)
    FVector CameraPosition = Client->GetViewLocation();

doesnt work for me

in 4.19 i do it like this

	auto client = (FLevelEditorViewportClient*)GEditor->GetActiveViewport()->GetClient();

	if (client != nullptr) {
		UE_LOG(LogTemp, Display, TEXT("Camera Location: %s "), *client->GetViewLocation().ToString());
1 Like

This is a horribly late reply but have a look at the Get Set Editor Camera plugin: