Project node returning wrong coordinates

hi community !
got a little issue here, and can’t find a solution.
i 'm trying to add a simple crosshair to a spaceship, kind of thirdperson view.
so i made a widget, and use the project node to get the position i want in world space, to convert in sceen space.
but there is a difference between both coordinates,
in pictures :

so the rounded one is geometry from with i want to get the the world coord. and the ugly one is the widget with the projected coords. there is an offset . and can t get where it comes from. it s non constant seems like a calculation error.

the node in blue is just the center offset depending on the resoultion (for now 1280/720)
any one knows what have i done wrong? thanks in advance !

You missed to use the DPI scaling for your Calculations. You can find the DPI Curve in ProjectSettings->UserInterface->DPI Curve

You can Adjust it to your needs and how it behaves. Or you could Flatten it out so every resolution will have a Scale of 1. But by Doing this you turn off all benefits that come with Auto Scaling your Widgets depending on the Resolution. You can access the current DPI Scale with the “Get Viewport Scale” Node. A simple Multiply by this Value can give you the Result you want. Log your Numbers and write them down so you always know with what Value you are Dealing (Scaled or Raw). You can change the Size of your Viewport while the Game is running to See the DPI Scaling in Action and if its behaving like you want.

The Math is Up to you. Good Luck and have Fun =)

thanks a bunch !
understood a mlot thanks to you.
but there might be an other issue there,
while the ship is just moving forward, it works, but there is a slight offset growing while turning.

must have missed something else :slight_smile:

Your Best bet is to log the Numbers. Numbers rarly lie. Cant Debug remotly without numbers in front of me. For me this little gap still looks like a DPI issue you maybe applied DPI Scale where it was unecessary. Take a Paper start sketching the Numbers out. Draw every Number you know and what it represents and run the Math by Hand, see what number ends up not what you expect it to be.

If you start putting Nodes together and hope it works with one or the other you playing the guessing Game ;P. Your Math should be Solid and understanded by you. Otherwise you will run into trouble over and over again. Dont forget to Comment your Code.

well thanks.
i think i understood the dpi scaling stuff, and the maths here are pretty basic.
the thing i don’t understand, is that, event while playing it at 1920x1080 (so dpi scale at 1) i still got this offset, and even tried with an other test hud, anchored top left, with a position in viewport node, (that don’t use dpi scale) and still got the same offset.
i 'm starting to think that puttin the reference point on a spring arm was not the best idea, should go for a trace line and i ll see.

well forgot to close here.
figured that it was not an offset but just that the refresh rate of the umg was different of the rest.
problem solved.