"Project World Location to Widget Position" is seemingly incorrect

I’m trying to put a reticle (widget that I added to the viewport) over the impact point of a ray trace. However, when I convert the world coordinates to screen coordinates, the screen coordinates are way off in the bottom right corner. I tried subtracting half the resolution, but there was still considerable offset from where it is supposed to be. Building off of that, I experimented with different screen resolutions, but each one has a different offset from center and in different ways, so I can’t just compromise with some sort of set distance. I also tried “Project World to Screen” instead, which has a slightly different location but still very wrong. Here’s the most relevant code:

I discussed this extensively with someone in the UE discord to no avail. Looking online, it seems like this is a common issue with no concrete solution. We also tried using the hit result’s “location” instead of “impact point”, and messing with “set alignment in viewport”.

A few other notes, this code executes in the HUD, and I can confirm that setting the widget location to (0, 0) is definitely the center of the screen.

Maybe too late, but I stuck with this, and here is the solution:

https://www.reddit.com/r/unrealengine/comments/1abssz4/project_world_location_to_widget_position_is/

Set the Widget anchor and location to the left top corner instead of the center.

Hey,

I have similar case where I need a widget on an actor. This is all in the UserWidget and Target Actor is set externally.

I’m guessing it’s not a big leap to change the actor to custom world coordinates.

Hope this helps :slight_smile: