FVector2D FRTSHelpers::Project(FVector WorldPosition, ULocalPlayer* Player) { FVector2D retVal = FVector2D::ZeroVector; if (Player != NULL && Player->ViewportClient != NULL && Player->ViewportClient->Viewport != NULL && Player->PlayerController != NULL) { FSceneViewProjectionData ProjectionData; if (Player->GetProjectionData(Player->ViewportClient->Viewport, eSSP_FULL, /*out*/ ProjectionData)) { FMatrix viewProjectionMatrix = ProjectionData.ViewMatrix * ProjectionData.ProjectionMatrix; FIntRect theViewRect = ProjectionData.GetViewRect(); FPlane Result = viewProjectionMatrix.TransformFVector4(FVector4(WorldPosition, 1)); retVal.X = (int)((((1 + (Result.X / Result.W)) / 2.f) * theViewRect.Width()) + 0.5f); retVal.Y = (int)((((1 - (Result.Y / Result.W)) / 2.f) * theViewRect.Height()) + 0.5f); } } return retVal; }