# Spawning an object on "On Drag Cancelled"... spawns in weird locations

**URL:** <https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [October 1, 2021, 3:03pm UTC](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644 "2021-10-01T15:03:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Larpushka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Larpushka](https://forums.unrealengine.com/u/Larpushka)\
**Post date:** [October 1, 2021, 3:03pm UTC](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644/1 "2021-10-01T15:03:19Z")

</div>

I created a drag and drop widget that’s supposed to spawn a 3D object. From some reason it always spawns at around the middle of the scene area, not when the dragged was cancelled. I was trying to play with it but can’t figure it out, any idea what am I doing wrong?

 ![drag_n_drop](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/9/69693eebc798c14f55057c92bd83308554650e60.jpeg)

Upper left corner you see the widget, in the center of the screen you see all the spawned cubes

 ![result](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/4/f439b555ed046c4c3f23c6225b609ae831a9c28a.jpeg)

---

<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:** [October 1, 2021, 3:40pm UTC](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644/2 "2021-10-01T15:40:57Z")

</div>

The line trace is not set up correctly. It’s not setup at all, actually.

Can’t recall if that node can fetch mouse position at the time of drag cancel. It’s the Pointer Event that knows the position. So I’d _probably_ use that instead in this case.

How close is this to what you need:

> [@Getting Mouse Position During Drag and Drop UMG](https://forums.unrealengine.com/t/getting-mouse-position-during-drag-and-drop-umg/85760/15):
>
> 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: in the Custom Drag & Drop Operation blueprint Event Dragged spits out screen space coordinates and feeds them to an Event Dispatcher, we…

---

<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:** [October 1, 2021, 3:46pm UTC](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644/3 "2021-10-01T15:46:22Z")

</div>

Before you evaluate / attempt to fiddle with the above, try this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/e/2ee5fad36049fbfb7c1b4def889f3dd1dd3f5653.png)

Untested and 99% sure it’s not going to work…

---

<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:** [October 1, 2021, 3:49pm UTC](https://forums.unrealengine.com/t/spawning-an-object-on-on-drag-cancelled-spawns-in-weird-locations/253644/4 "2021-10-01T15:49:39Z")

</div>

And here’s a simpler alternative if you do not need to drag a widget, just spawn an actor:

> [@Dragging 3D object 'out of' a UI button but position not updating when holding](https://forums.unrealengine.com/t/dragging-3d-object-out-of-a-ui-button-but-position-not-updating-when-holding/232066/6):
>
> so many different links of events… […]if there’s a way to approach this in a simpler fashion Let me clarify; what I originally suggested is suitable for a situation where you want both - dragging a widget and dragging an actor around simultaneously. Spawning and dragging after an interface click is easier as we don’t care about widget position: [[Image from Gyazo]](https://gyazo.com/845ee0e5a16140ad15da7f127fe34cf8) The above should be in the Player Controller. Here the button was set to Mouse Down so it releases focus even though i…
