Hi
i try to get the **ProjectWorldToScreen **from the active camera. (not from the player )
because i need to use on the editor.
and actually for the ProjectWorldLocationToScreen need a APlayerController
and if i understand correctly, is active only on begin play so is null on the editor
How can i get a screenSpace vector from the current camera in editor mode ?
can i convert the camera to a player ?
i be able to getting the active camera
auto world = GetWorld();
UE_LOG(LogTemp, Warning, TEXT("GETWORLD start "));
if (world == nullptr)
return;
UE_LOG(LogTemp, Warning, TEXT("GETWORLD OK "));
auto viewLocations = world->ViewLocationsRenderedLastFrame;
if (viewLocations.Num() == 0)
return;
UE_LOG(LogTemp, Warning, TEXT("num Win : %d "), viewLocations.Num());
FVector camLocation = viewLocations[0];
UE_LOG(LogTemp, Warning, TEXT("SCREEN POS %s "), *camLocation.ToString());
static [bool](https://docs.unrealengine.com/en-US/API/Runtime/LiveLinkInterface/bool/index.html) ProjectWorldToScreen
(
[APlayerController](https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/APlayerController/index.html) const * Player,
const [FVector](https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FVector/index.html) & WorldPosition,
[FVector2D](https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FVector2D/index.html) & ScreenPosition,
[bool](https://docs.unrealengine.com/en-US/API/Runtime/LiveLinkInterface/bool/index.html) bPlayerViewportRelative
)
Thank you very much for your help
Best Regards
Daniel