The new “ProjectWorldLocationToWidgetPosition” just doesn’t seem to be working. As the world position moves horizontally in the viewport (with no vertical movement at all), the screen position it is calculating seems to move around in a circle around the world position
In an effort to try to remove any extraneous variables, I have set my DPI scaling to 100%, set my resolution scale to 100%, I’m using full-screen mode (in a separate window other than the editor window), AND I have even set the screen resolution to 1280 x 720 (even though this function is supposed to compensate for all these factors).
So, here’ the blueprint I’m using – this is in a UserWidget that has been added to the Viewport at runtime:
The “SelectedTPP” is another ThirdPersonPlayer Actor (I’m just using the Third-Person Player Template project to test this out). The “ReticleLL” is an Image Widget that has been set as a Variable for this UserWidget. The “ReticleLL” is using a lowerleft anchor (I’ve tried with other anchors and it doesn’t seem to make a difference), and it is set so that it’s pivot point is 0.5f, 0.5f (so, it’s right in the middle).
The results are as the object moves directly left to right in the viewport, the Reticle object moves in a “U-shaped” path from the left of the screen to the right of the screen. As the object moves directly right to left in the viewport, the Reticle object moves in an “Arch-shaped” path from the right of the screen to the left of the screen.
Object is on left-side of screen:
Object is at 25% of screen:
Object is at 50% of screen:
Object is on right-side of screen:
I was able to reproduce this issue on our end. I have written up a report (UE-16122) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. I have a workaround that may be viable depending on your project. I have set the anchor point to the top left (this workaround will not work otherwise) and I then used the set position node instead of setting the render translation. I have provided an example below. Thank you for your information and time.
Make it a great day
Thank you, Rudy - I’ll try this workaround today.
You also need to set the Alignment (0.5, 0.5) in the canvas slot. Pivot only applies for additional render transforms after the initial layout location has been determined.
Set position on the slot is the expected approach.
Now it’s doing something completely unexpected. I changed the SetRenderTranslation function to the SetPosition function (added the necessary “SlotToCanvasSlot”)
…but now the image is stretching from skinny and long to tall and narrow as the target moves from left to right on the screen. It’s also artificially moving up vertically as the world position target gets closer to the right-hand side of the screen.
That was really unexpected… but here’s the screenshots from left to right…
I don’t have any code at all in there that would change the size of the these widgets (I triple-checked) – I’m not even sure off-hand how that would be done. I can guarantee you I’m not altering the size of these widgets in code. I literally just replaced the one function with the other one and added the necessary “SlotToCanvasSlot” node.
When I set the canvas slot alignment (as Nick suggested), then it stopped moving up artificially. Instead, that caused it to begin moving down and backwards when it got to about 75% of the way across the screen – so, it made matters worse.
Here’s an image to explain what I’m seeing. The green line shows the position of the target actor in world space as it moves across the screen. The red line shows the position the reticle is being moved to. The length of each line is directly proportional to time, so that when the green line reaches its end point, the red line is also at its end point (at the bottom of the screen) at the same time.
So… yeah, still doesn’t work.
Target on left-hand side of screen:
Target in middle of the screen:
Target on the right-hand side of the screen (reticle also artificially moved up to top of screen):
I am unable to reproduce the results that you are seeing on your end. I have a few questions for you that will help narrow down what issue it is that you are experiencing.
- Can you reproduce this issue in a clean project?
- If so, could you provide a detailed list of steps in order to reproduce this issue on our end?
- Could you provide the current project that you are working on so that I could take a closer look?