# "Get Mouse Position on Viewport"

**URL:** <https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [May 27, 2018, 8:14pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399 "2018-05-27T20:14:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![G1K777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@G1K777](https://forums.unrealengine.com/u/G1K777)\
**Post date:** [May 27, 2018, 8:14pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/1 "2018-05-27T20:14:06Z")

</div>

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.

[![]( " - YouTube") ](https://www.youtube.com/watch?v=JptOE51ixps)

---

<div class="post-metadata">

**Author:** ![Khubur](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/khubur/32/1223964_2.png) [@Khubur](https://forums.unrealengine.com/u/Khubur)\
**Post date:** [May 27, 2018, 9:41pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/2 "2018-05-27T21:41:42Z")

</div>

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](http://api.unrealengine.com/INT/BlueprintAPI/Viewport/GetMousePositionScaledbyDPI/index.html))  
or try to change DPI scale parameter. [DPI Scaling](https://docs.unrealengine.com/en-us/Engine/UMG/UserGuide/DPIScaling)

---

<div class="post-metadata">

**Author:** ![anon75881332](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon75881332](https://forums.unrealengine.com/u/anon75881332)\
**Post date:** [April 9, 2020, 5:21am UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/3 "2020-04-09T05:21:10Z")

</div>

I will refresh the topic because I had a problem with this. This is the solution:  
Function [Get Mouse Position on Viewport](https://docs.unrealengine.com/en-US/BlueprintAPI/Viewport/GetMousePositiononViewport/index.html) and multiply the result by Function: [Get Viewport Scale](https://docs.unrealengine.com/en-US/BlueprintAPI/Viewport/GetViewportScale/index.html)

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

---

<div class="post-metadata">

**Author:** ![Munghard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Munghard](https://forums.unrealengine.com/u/Munghard)\
**Post date:** [June 2, 2021, 12:44pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/4 "2021-06-02T12:44:32Z")

</div>

Thanks man, this is spot on.

---

<div class="post-metadata">

**Author:** ![kernelkiller](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kernelkiller](https://forums.unrealengine.com/u/kernelkiller)\
**Post date:** [June 23, 2021, 3:08pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/5 "2021-06-23T15:08:47Z")

</div>

Confirmed, this works.

---

<div class="post-metadata">

**Author:** ![Jonbir](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jonbir](https://forums.unrealengine.com/u/Jonbir)\
**Post date:** [October 2, 2021, 5:09pm UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/7 "2021-10-02T17:09:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [December 26, 2023, 6:52am UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/8 "2023-12-26T06:52:38Z")

</div>

> [@anon75881332](#):
>
> Function: [Get Viewport Scale](https://docs.unrealengine.com/en-US/BlueprintAPI/Viewport/GetViewportScale/index.html)

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

---

<div class="post-metadata">

**Author:** ![LN1995](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LN1995](https://forums.unrealengine.com/u/LN1995)\
**Post date:** [February 21, 2025, 5:24am UTC](https://forums.unrealengine.com/t/get-mouse-position-on-viewport/111399/9 "2025-02-21T05:24:24Z")

</div>

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. 😬
