# Get mouse position ov Viewport and Get Viewport size

**URL:** <https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint\
**Created:** [August 31, 2022, 7:33am UTC](https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695 "2022-08-31T07:33:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleg\_UE5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Oleg\_UE5](https://forums.unrealengine.com/u/Oleg_UE5)\
**Post date:** [August 31, 2022, 7:33am UTC](https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695/1 "2022-08-31T07:33:36Z")

</div>

I am trying to make a function with blueprint that normalize mouse coordinates in a way that center of my viewport is 0, 0.  
Formula is following MouseX - DisplayX/2, MouseY - DisplaY/2

The problem is Get mouse position on Viewport returns different value at the edge of my view port then Get Viewport size. Delta is not huge, about 150-200 pixel. But this makes the center go off. For example with viewport length of 1900 the most right X pos would be around 1750.

update:  
To make things work I had to divide GetViewPortSize by GetViewPortScale. Could some one explain why is it necessary? Is there a way to get correct ViewPortSize right away without this operation?

---

<div class="post-metadata">

**Author:** ![Supremative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremative/32/906564_2.png) [@Supremative](https://forums.unrealengine.com/u/Supremative)\
**Post date:** [August 31, 2022, 7:44am UTC](https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695/2 "2022-08-31T07:44:37Z")

</div>

You should consider the viewport scaling.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/1/5/31516c1efdf6d76795fc7a9d4534eb2795138265.png)

[My Products](https://www.unrealengine.com/marketplace/en-US/profile/Aleksandr+Sidorov)

---

<div class="post-metadata">

**Author:** ![NeetPeet](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/neetpeet/32/88719_2.png) [@NeetPeet](https://forums.unrealengine.com/u/NeetPeet)\
**Post date:** [May 11, 2024, 2:28pm UTC](https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695/3 "2024-05-11T14:28:38Z")

</div>

Thank you so much! You helped me after trying to figure out what’s happening for hours

---

<div class="post-metadata">

**Author:** ![araz01](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/araz01/32/1028814_2.png) [@araz01](https://forums.unrealengine.com/u/araz01)\
**Post date:** [January 24, 2026, 5:05am UTC](https://forums.unrealengine.com/t/get-mouse-position-ov-viewport-and-get-viewport-size/637695/4 "2026-01-24T05:05:18Z")

</div>

the way i did it, inside a widget, i get viewport size, then screen to viewport and there i have a working data and correct length that works with get mouse position scaled by dpi, these 2 settings have same measurement of screen space, so i get correct data, regardless of screen size, thus i can measure the middle of screen always, works!
