# ARPG rotate player towards mouse?

**URL:** <https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [April 4, 2023, 8:09pm UTC](https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356 "2023-04-04T20:09:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krileon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krileon](https://forums.unrealengine.com/u/Krileon)\
**Post date:** [April 4, 2023, 8:09pm UTC](https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356/1 "2023-04-04T20:09:54Z")

</div>

I can’t seam to figure out how to get this working without having to line trace from the camera to my cursor. This requires a blocking hit under the mouse to work. So if my mouse is not hovering something blocking this fails so it’s not a reliable solution. Putting a giant collision box under the map won’t work either as my maps are randomly generated with various heights.

Is there really no way to do this? I can’t use mouse axis because of an unreal bug that they refuse to fix where if you show the mouse cursor you don’t get the axis unless holding down a mouse button. I’m at my wits end here. Why is it so difficult to just look at the mouse!

The camera is at an angle on a spring arm like any standard ARPG shown below.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/2/122c0d6f7a01b36aad27b7908d86543352fb84c2.jpeg)

My WASD movement is setup so left always moves left, right always right, up always up, and down always down. So WASD is fully functional.

I’ve already tried the solution in the below topic and it’s completely off. Maybe it’d work if you’re directly looking over the player as 2D topdown, but my game isn’t as such.

> [@How to use Mouse aim on 2D Top-down view](https://forums.unrealengine.com/t/how-to-use-mouse-aim-on-2d-top-down-view/406051):
>
> Actually i found some questions about similar topic here. there was nice answer about their problem. but it wasn’t fit to my needs and i don’t good at english so i couldn’t modify it by my self. i will develop my game on 2D Top down view like hotline miami, want to use mouse aim for character rotation but not on movement but i don’t know how. Press W is always go to up, S is always go to down A is always go to left, D is always go to right. is there any solution for me? or is there any good…

---

<div class="post-metadata">

**Author:** ![Krileon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krileon](https://forums.unrealengine.com/u/Krileon)\
**Post date:** [April 4, 2023, 8:16pm UTC](https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356/2 "2023-04-04T20:16:04Z")

</div>

Below is my current working solution.

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

The issue is if there’s nothing blocking under my mouse it will fail. So it’s not reliable.

---

<div class="post-metadata">

**Author:** ![Krileon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krileon](https://forums.unrealengine.com/u/Krileon)\
**Post date:** [April 4, 2023, 8:41pm UTC](https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356/3 "2023-04-04T20:41:47Z")

</div>

ConvertMouseToWorldLocation also fails if there’s nothing blocking under the mouse. The best way would be to just use mouse axis, but I can’t if I want to also show the mouse cursor. Has anyone found a workaround for that?

---

<div class="post-metadata">

**Author:** ![Krileon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Krileon](https://forums.unrealengine.com/u/Krileon)\
**Post date:** [April 4, 2023, 8:48pm UTC](https://forums.unrealengine.com/t/arpg-rotate-player-towards-mouse/845356/4 "2023-04-04T20:48:52Z")

</div>

Spoke too soon. ConvertMouseToWorldLocation does work fine. My old usages IF check was the buggy part. The below works perfectly now.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/a/5da945a78bd93150af0d89cd098dbe101fb46235.png)

It’s similar to the linked thread, which didn’t work for me, that the Line Start is the mouse world location. The line end is the mouse world location + rotation x 5000. Then check look at rotation and you’re set.
