I’m trying to draw some text on the screen in AHUD::DrawText() method.
Now, I think, I have find it how to do it: using ProjectWorldLocationToScreen
. But now I don’t know which is the WordLocation I have to use.
On Unreal Editor, on my map I have a static mesh that I’m using as reference. I get in the editor its Transform → Location coordinates to use it with ProjectWorldLocationToScreen
.
And here is the C++ code:
FVector2D sLoc;
GetOwningPlayerController()->ProjectWorldLocationToScreen(FVector(530.0f, -6.0f, 871.0f), sLoc);
DrawText(PlayerScoreString, FColor::White, sLoc.X, sLoc.Y, TextFont, TextScale);
But this is what I see:
The number 5 is what I draw as text, and the small white vertical rectangle in its left is the cube I selected in the Unreal Editor.
What am I doing wrong? How can I get (or know) the correct World coordinates for the rectangle?