# Getting Mouse Position During Drag and Drop UMG

**URL:** <https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [February 20, 2017, 5:39pm UTC](https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760 "2017-02-20T17:39:01Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 29, 2021, 7:44am UTC](https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760/15 "2021-04-29T07:44:13Z")

</div>

> [@Nonlin](#):
>
> Why is this still so cryptic?

`Because it's undocumented, arcane knowledge obtainable only by those knowing a secret handshake.`

* * *

The below assumes you have overridden and using a Game Mode, a Player Controller and created a custom Drag & Drop Operation.

* * *

- in the Player Controller

A Custom Event converts screen space to world space via deprojection and sets actor’s position:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/7/17f6484605190263ef07310e7125014b95719968.jpeg)

* * *

- in the Custom Drag & Drop Operation blueprint

Event Dragged spits out screen space coordinates and feeds them to an Event Dispatcher, we also provide an actor reference (more on that below). We’re using an actor, not an object - the assumption is that you actually want an actor. This _Actor Payload_ variable is flagged as _Instance Editable_ and _Exposed on Spawn_.

You could use the standard Drag OP Payload Object but you’ll need to cast to actor later on. An actor is more convenient in this instance.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/5/9511644c3b0d67b80111eece4fd0818664582ea6.png)

* * *

- in the Widget being dragged:  
– when drag is detected, we spawn an actor  
– create the abovementioned custom Drag Op and feed the actor’s reference into Actor Payload (explained above)  
– up to you how to handle the Default Drag Visual part  
– we then bind the Drag OP’s Dispatcher call with the Player Controller’s Event (first pic)  
– return drag result

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/3/b3cc4a510ee3c9f09a8329b521dbcbc67a5bd84e.jpeg)

Should work in any resolution / DPI / aspect ratio. _fingers crossed_

* * *

There are other methods of handling similar behaviours. The approach would depend on what the end goal is and how it’s supposed to work. If in doubt, do provide the details.

---

_[View the full topic](https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760)._
