The ProjectWorldToScreen should transforms the given 3D world-space point into a its 2D screen space coordinate.
But when it’s not possible, it should return a false boolean to the “Return Value”.
In 4.19 (it’s working fine in 4.18), the return value is always true. And it seems that when the result should be false, the returned screen position is the last valid one.
This probably comes from that line of code :
bResult = Player->PostProcessWorldToScreen(WorldPosition, ScreenPosition, bPlayerViewportRelative);
(In the definition of ProjectWorldToScreen in UnrealEngine/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp)
Because that function is defined that way :
bool APlayerController::PostProcessWorldToScreen(FVector WorldLocation, FVector2D& ScreenLocation, bool bPlayerViewportRelative) const
{
return true;
}
(In UnrealEngine/Engine/Source/Runtime/Engine/Private/PlayerController.cpp)
So it basically always return true…
That’s cool, I already submited a bug report, but I wanted to know if it was possible to (temporary) calculate that boolean correctly ? I was thinking about getting the camera rotation, but I can’t find how to do that in blueprint…
I was also thinking about using FSceneView::ProjectWorldToScreen instead of UGameplayStatics::ProjectWorldToScreen, but I prefer not to add useless c++ that I will delete when the bugfix is done. (Yeah, I prefer to add useless blueprint macro than useless c++ function !)