# Left Mouse button pressed and released equivalent in enhanced input (or drag and drop)

**URL:** <https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [January 22, 2024, 9:02am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884 "2024-01-22T09:02:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 9:02am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/1 "2024-01-22T09:02:40Z")

</div>

Hi!

I’m using Unreal 5.3.2.

What is the equivalent for this in enhanced input?

![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/4/2c424a4eda325253a42de631c6554fcec1d6e16f.png)

Sorry, but I’m blocked.

I think it could be an input action with bool as Value Type.

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/8/4/d844b3ae4a97162dcfc758f04e177d697dce7bdf.png)

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/e/60e291aca3dda213147d27c9ae8c4a10e46b8cdf.png)

Thanks!

---

<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:** [January 22, 2024, 9:38am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/2 "2024-01-22T09:38:10Z")

</div>

> [@ViaCognita](#):
>
> What is the equivalent for this in enhanced input?

Just default input with no changes. Use Started/Completed.

> bool as Value Type.

It does not matter _here_. It does not affect the functionality per se, merely spits out a piece of data that can be used for something else.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 9:40am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/3 "2024-01-22T09:40:55Z")

</div>

@Everynone I’m going to test this:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/2/98217f5ffec5c3d32e97f3f1331f14b959e705e7.png)

I’m going to use the **Hold** trigger.

---

<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:** [January 22, 2024, 9:42am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/4 "2024-01-22T09:42:26Z")

</div>

> [@ViaCognita](#):
>
> I’m going to test this:

Sure. But that’s not what you want:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/a/49a1d6dfb747494d495674e947f52a2f559ef84c.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/8/048b083056a5653532252afbbec3641703700b46.png)

Hold serves a very different purpose.

* * *

If you want the equivalent, it’s just a default node with nothing changed, no modifiers and no triggers.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 9:46am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/5 "2024-01-22T09:46:44Z")

</div>

> [@Everynone](#):
>
> But that’s not what you want:

Well, I think I make a mistake.

I want to use the mouse to drag and drop actor while playing a game.

I’ve found your answer here [How to click drag/move an actor during runtime play? - #3 by Pheonix00](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/3), and I think you were using drag and drop in there.

But I want to press the left button over an actor, and while pressing it, move it to another place. Finally, I will release the left button.

Thanks.

---

<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:** [January 22, 2024, 9:49am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/6 "2024-01-22T09:49:51Z")

</div>

> [@ViaCognita](#):
>
> But I want to press the left button over an actor, and while pressing it, move it to another place.

A default input node with no changes is fine. You can even use the `Triggered` instead of Tick.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 9:59am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/7 "2024-01-22T09:59:43Z")

</div>

> [@Everynone](#):
>
> `Triggered` instead of Tick

Tick? The tick event?

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/5/5f5fd2565e29c3f56eb0bd4027c7d604296db85a.png)

I think `Triggered` is the first option, but I’m confused with Tick.

Thanks a lot.

---

<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:** [January 22, 2024, 10:01am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/8 "2024-01-22T10:01:42Z")

</div>

If you want to do something every frame - dragging - you need to update location of the actor every frame. Normally, `Tick` would be used for that since it executes every frame.

The EI has the advantage of spitting out an update during `Triggered` at the very top. So you can do the entire dragging system using just the node above. Try:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/0/fe091c8d9bc53960f61b818b725fae43f3eac603.png)

To see what I mean.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 10:07am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/9 "2024-01-22T10:07:25Z")

</div>

OK. I hadn’t seen the `Tick` event in your answer: [How to click drag/move an actor during runtime play? - #3 by Everynone](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/3)

Thanks a lot.

---

<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:** [January 22, 2024, 10:08am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/10 "2024-01-22T10:08:24Z")

</div>

> [@ViaCognita](#):
>
> I hadn’t seen the `Tick` event in your answer:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/1/1/0116c29f388c7ef5f504c2d8764fcfd29785e6ae.jpeg)

But again, you do not even need it here.

---

<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:** [January 22, 2024, 10:13am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/11 "2024-01-22T10:13:51Z")

</div>

In case there was any doubt:

- enhanced input with default settings:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/7/f/f7f84f8d6c2cab2b01681707b294740f0105248c.png)

- Drag:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/d/53dccc17c81b2b86c47daf128b7df2eeb757f19f.png)

- Get Hit Actor:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/a/68a60a35731a20cfdc4704b4812da3aa986185e3.png)

- Complete Drag

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/a/04a70c9d27fb20db04c04344d6bc7d6603956b08.png)

This can be improved. I’d start by isolating collision with channels / object types. Then incorporate offsets based on components bounds so they do not intersect with the geometry they’re sliding on. Plenty of other stuff, too, depending on what this is going to be used for…

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 10:19am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/12 "2024-01-22T10:19:44Z")

</div>

> [@Everynone](#):
>
> In case there was any doubt

I love you.

---

<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:** [January 22, 2024, 10:20am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/13 "2024-01-22T10:20:01Z")

</div>

😊

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [January 22, 2024, 5:57pm UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/14 "2024-01-22T17:57:46Z")

</div>

I have another question:

How can I move it only in ZY Plane?

When I try to move it up, it moves on the X axis.

Thanks.

---

<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:** [January 22, 2024, 7:09pm UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/15 "2024-01-22T19:09:44Z")

</div>

In the drag function, we feed it a vector with all 3 XYZ components. You can set X to a fixed value.

Depending on how the whole thing is supposed to work, it might be better to adopt a smarter tracing method. You can get quite consistent result with Line Plane Intersection.

Rather than relying on gemeotry to get hit, you trace against a virtual plane that can be oriented any way you want.

Imagine you have an invisible wall behind those cubes, you can trace against that instead, rather than the floor…

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [February 8, 2024, 9:25am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/16 "2024-02-08T09:25:27Z")

</div>

Thanks for your comments, but I haven’t understood anything. Maybe, I need to study more mathematics.

I’ve been trying to don’t move the block when I click on it, but without successful. And also moving it along the ZY Plane with the same result.

I don’t understand what it is a Line Plane Intersection, and why you mention the floor. In the code it seems that you use a line trace to the block, not to the floor.

---

<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:** [February 8, 2024, 9:31am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/17 "2024-02-08T09:31:11Z")

</div>

> [@ViaCognita](#):
>
> I don’t understand what it is a Line Plane Intersection, and why you mention the floor. In the code it seems that you use a line trace to the block, not to the floor.

You asked an additional question:

> How can I move it only in ZY Plane?

`Line Plane Intersection` allows you to create a virtual plane anywhere and trace against it so you do not need to rely on geometry. To visualise it:

> [@Line Trace from a 3d point to mouse location](https://forums.unrealengine.com/t/line-trace-from-a-3d-point-to-mouse-location/237661/3):
>
> You’re tracing with a fixed distance of 500, replacing the projection’s X with a fixed value. It’s actually hard to imagine how that would look like, a strangely distorted / twisted undulating surface mayhaps? cool, for sure. I want this trace to stay on the same plane as my character, so the X value of the start point & end point should be the same. Consider the following: green_circle create a virtual plane where the character is and point it towards X (Plane Normal 1,0,0) …

---

<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:** [February 8, 2024, 10:27am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/18 "2024-02-08T10:27:59Z")

</div>

Here’s some script allowing for picking up stuff and moving it in a specific plane only we determine ourselves manually:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/8/2383f14d0fec96365b772c1ef242963902cf3da5.jpeg)

The green debug plane visualises what’s going on. In short: shoot a beam (trace) from the screen centre towards the projected mouse cursor, when it eventually _intersects_ that plane (which is infinitely large), place the actor at the intersect world coordinate.

If I change the normal:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/e/d1e172b10984c1d2a4cb21859ec661e2904e91f1.png)

You could derive this `Normal` from the actor itself instead:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/9/e/49e9721e6b21e39e7da8351223bab756fff20d7f.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/f/e/cfecf0ddf40218a9cc542bbd830e3a02db5d6cac.png)

* * *

Or you can get it from the surface in the world - tracing returns a Normal, you do not need the virtual plane then:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/d/c2d3e14f1876f845ccc81a3da4bcda06f7b1b845.png)

* * *

> I haven’t understood anything

Set up a new project, replicate the above, experiment, see what you can learn. At some point the whole thing will _click_.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [February 9, 2024, 8:38am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/19 "2024-02-09T08:38:18Z")

</div>

Thanks a lot.

It works perfectly. Sometimes it seems that the cube rotate, I don’t know why.

Before I drag it:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/8/0c8e43045358ac0b303229768f83a94638e8ffce.jpeg)

After:

 ![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/6/41606e851932d808ae0fb7158f301dbdf5d69889.jpeg)

Let me check what it’s happening.

---

<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:** [February 9, 2024, 8:47am UTC](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/20 "2024-02-09T08:47:16Z")

</div>

> [@ViaCognita](#):
>
> Let me check what it’s happening.

A single axis has too much ambiguity, you may need to build your rotations from 2 or 3:

> [@Spawning Object (emitter) with the right rotation](https://forums.unrealengine.com/t/spawning-object-emitter-with-the-right-rotation/1670726/7):
>
> A lot of things! Too many to mention, honestly. all the light calculation revolves around it, the angle at which light bounces of every surface you see physics calculation, think spheres bouncing of a wall at correct angles is the ramp in the pic below too steep for my character to walk on? if I make rotation from “normal” I get the rotation of the surface Yes, here’s the normal - a vector that is perpendicular to the surface: [310px-Normal\_vectors\_on\_a\_curved\_surface.svg] But there …

[Next page](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884.md?page=2)
