Accessing the position of the editor viewport camera

Thanks great answer! If you need both location and rotation i found this useful (https://answers.unrealengine.com/questions/5155/getting-editor-viewport-camera.html)

FViewport* activeViewport = GEditor->GetActiveViewport();
FEditorViewportClient* editorViewClient = (activeViewport != nullptr) ? (FEditorViewportClient*)activeViewport->GetClient() : nullptr;
if( editorViewClient )
{
	viewPos = editorViewClient->GetViewLocation();
	viewRot = editorViewClient->GetViewRotation();
}
7 Likes