"Get Mouse Position on Viewport"

Hello, i found a really bad bug or what ever this is.

I have a print screen node there that shows:

  1. Viewport resolution (Get Viewport Size)
  2. Mouse position (Get Mouse Position on Viewport)

My Windows resolution is 2560x1440.

The “Get Viewport Size” works fine, i even test this with Photoshop and cutout that viewport and it was 1:1. So it works fine.
But “Get Mouse Position on Viewport” is so off it’s just insane. In the video i stretch the game window and the values where insane! Even tho my monitors width resolution is 2560 the output was 3600+ like it would use some “DSR (Nvidia Dynamic Super Resolution aka Upscaling)”.

Can someone explain me what’s going on and what i’m doing wrong?

I did this in the “FlyingPawn” Blueprint.

1 Like

Hello,

The DPI(Dots per Inch) scalar settings might be get uncorrect result for your viewport.

Try to use this node: Get Mouse Posıtıon scaled by DPI](http://api.unrealengine.com/INT/BlueprintAPI/Viewport/GetMousePositionScaledbyDPI/index.html)
or try to change DPI scale parameter. DPI Scaling

I will refresh the topic because I had a problem with this. This is the solution:
Function Get Mouse Position on Viewport and multiply the result by Function: Get Viewport Scale

Kind of simple but I lost a lot of time on it.

19 Likes

Thanks man, this is spot on.

Confirmed, this works.

That’s the one. Thanks very much!
Quite surprising there’s no “SetMousePositionScaledByDPI”

This is the secret. The DPI scale doesn’t do it correctly!

1 Like

I believe it would be more straightforward and appropriate to name them accurately. If we have functions named “Get Viewport Size” and “Get Mouse Position on Viewport”, it’s intuitive for everyone to assume they are a complementary pair of functions. :grimacing: