Trouble trying to project world coordinate to screen

I am working on a racing game where i can auto target other racers based on my power up.
So i draw Arrow sprite in UMG by getting the world position to screen coordinate. It works fine when the game is in full screen that is 1920 x 1080 . if I test in window mode or editor it is going crazy.


 

Cast<APlayerController>(pawnRefernce->cont_Refernce)->ProjectWorldLocationToScreen(pawnRefernce->CowZookaTargetPawnRefernce->GetActorLocation(), pawnRefernce->ArrowPos, true);



would like to get help please :slight_smile:

problem : The canvas of widget was not scaling to the size of the current camera’s view port ratio, it only works with the fixed size that is represented in the widget.

solution : use the HUD canvas that scales properly with the current aspect ratio. and used ** AHUD::Project** to get the relative world to screen coordinates.