# Is it possible to freeze the cursor position in the viewport while still geting mouse delta?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-freeze-the-cursor-position-in-the-viewport-while-still-geting-mouse-delta/336559>\
**Category:** Blueprint\
**Tags:** viewport, unreal-engine, mouse-position, Blueprint, question\
**Created:** [October 26, 2015, 4:58pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-freeze-the-cursor-position-in-the-viewport-while-still-geting-mouse-delta/336559 "2015-10-26T16:58:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e159b8de](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e159b8de](https://forums.unrealengine.com/u/anonymous_user_e159b8de)\
**Post date:** [October 26, 2015, 4:58pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-freeze-the-cursor-position-in-the-viewport-while-still-geting-mouse-delta/336559/1 "2015-10-26T16:58:58Z")

</div>

I am making a blueprint that basically allows click and drag movement of a viewport displaying a 2d widget. The flow of execution goes pretty much like this:

1. When right mouse pressed → 
2. Get mouse delta → 
3. Amplify mouse delta → 
4. New Screen Coordinates = Old Screen Coordinates + Mouse Delta → 
5. Set Position in Viewport as New Screen Coordinates

The script works fine, but the problem is that mouse still moves when holding down right click.  
So my question is: Is there a function that freezes the cursor in the Viewport but still allows mouse delta capture?

---

<div class="post-metadata">

**Author:** ![Dopadream](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dopadream](https://forums.unrealengine.com/u/Dopadream)\
**Post date:** [July 31, 2021, 11:59pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-freeze-the-cursor-position-in-the-viewport-while-still-geting-mouse-delta/336559/2 "2021-07-31T23:59:49Z")

</div>

Bump, if anyone knows how to do this, or if it’s even possible, I have also been struggling with this exact scenario.

---

<div class="post-metadata">

**Author:** ![UnrealSolver](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unrealsolver/32/1194693_2.png) [@UnrealSolver](https://forums.unrealengine.com/u/UnrealSolver)\
**Post date:** [August 1, 2021, 1:17am UTC](https://forums.unrealengine.com/t/is-it-possible-to-freeze-the-cursor-position-in-the-viewport-while-still-geting-mouse-delta/336559/3 "2021-08-01T01:17:21Z")

</div>

There is no function for that

@dopadream - don’t place a question marked as “Answer” as it’s not an answer… This also wanted to make me skip this thread but I was curious about your “answer”

You can make your own function

Add a boolean which will check for RMB, when it’s true 1 time save coordinates then move the mouse back to this place when you’re moving the mouse - you’ll get the mouse movement still calculated and it will automatically go back to the place where you pressed the button

That’s the simplest way of doing it
