# How to move character depending if my mouse goes up or down?

**URL:** <https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166>\
**Category:** Blueprint\
**Tags:** flying, mouse-cursor, unreal-engine, Blueprint\
**Created:** [November 17, 2023, 12:12am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166 "2023-11-17T00:12:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sguerrer92](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sguerrer92/32/777247_2.png) [@sguerrer92](https://forums.unrealengine.com/u/sguerrer92)\
**Post date:** [November 17, 2023, 12:13am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/1 "2023-11-17T00:13:00Z")

</div>

Hi,

I have a dragon that flies but I want it to fly up if I move my mouse up and goes down when it detects that now I am moving my cursor down.

So now I have it working with 2 keys, F key to go up and V to go down, but I want it to be detected automatically.

How can I do that?

Thanks!

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [November 17, 2023, 9:20am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/2 "2023-11-17T09:20:16Z")

</div>

you could get the screen position of the mouse and check on tick/timer if its higher or lower than its previous position

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [November 17, 2023, 6:56pm UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/3 "2023-11-17T18:56:24Z")

</div>

More information on the effect you’re trying to achieve would be useful.

For instance, where is camera in relation to the dragon? Is a first or third-person character riding it with the camera following behind? Or is dragon moving independently of camera ( as in, like in a side scrolling game, or some non-player character you’re commanding remotely)?

And how should the downward motion occur? Should dragon rotate and dive towards the mouse input, or just move straight down as if it’s being dragged and dropped somewhere?

---

<div class="post-metadata">

**Author:** ![sguerrer92](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sguerrer92/32/777247_2.png) [@sguerrer92](https://forums.unrealengine.com/u/sguerrer92)\
**Post date:** [November 18, 2023, 1:51am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/4 "2023-11-18T01:51:59Z")

</div>

It is a third person camera, I have a character controller and inside the character I have my mesh which is my dragon and my camera.

The dragon starts moving once I click my mouse, so now I have it moving left and right correctly, but not up and down.

Maybe it is better with images:

So this is my BP so far, it works fine on X axis, but in Y it goes UP but the camera is not following my mesh, so maybe I am not doing it correctly.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/6/0c60011759e06eff2144b7a1aae71661013a2174.jpeg)

So here it’s what happens if I move up, the camera keeps down. If anyone has some good tutorial I can follow …it would be really helpful since I just found airplanes tutorials and didn´t work as I wanted to :c  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/9/40912b3174a74b848e2029d0fd3ede5b90e461ab.jpeg)

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [November 18, 2023, 4:01am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/5 "2023-11-18T04:01:24Z")

</div>

Easiest way to get third person flying is something like this:

 ![flyingstuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/f/f4fb30c1302542a8206b51bd6fc117ccd28adb4e.jpeg)

Plug the mouse y value from the IA Turn triggered exe pin into an Add Control Pitch Input node though so the camera will look up.

 ![ia_turn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/7/bd77d5f1057dd2664416609530a4950713196cfa.jpeg)

Just call start flying event (or change it to a function) whenever you’d like flying to kick in. Like if you hit jump and falling is true.

Then call stop flying with the On Hit event of character to make them land when they collide with something. With UseControllerDesiredRotation and UseControllerPitch both set to true, if you aim camera up, moving forward will fly up.

Should look something like this when flying. Ignore the de-synced rider animation and, well, the fact it’s a pig, not a dragon:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/5/ef539f5a019750b1132c092c3b4bcf8c738fa007.jpeg "When pigs fly") ](https://www.youtube.com/watch?v=OLUx_mz1QLM)

Using raw mouse input to add move input up and down could get wonky real quick when the mouse gets to edge of screen. If you really want to do it this way though, add a branch after you add yaw input in the IA Turn event to check for flying, then feed the y from event into an add movement node with up (or maybe down depending on how you configured the axes) as the vector:

 ![mousedragfly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/d/f/ddfc07196a167a28d2755690e023bbfd161cde4b.jpeg)

---

<div class="post-metadata">

**Author:** ![sguerrer92](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sguerrer92/32/777247_2.png) [@sguerrer92](https://forums.unrealengine.com/u/sguerrer92)\
**Post date:** [November 18, 2023, 6:21am UTC](https://forums.unrealengine.com/t/how-to-move-character-depending-if-my-mouse-goes-up-or-down/1396166/6 "2023-11-18T06:21:10Z")

</div>

Thank youuuuuuu!!!
