# Center of Rotation Issues with Mouse Position in UE5

**URL:** <https://forums.unrealengine.com/t/center-of-rotation-issues-with-mouse-position-in-ue5/1890971>\
**Category:** Blueprint\
**Tags:** rotation, aiming, unreal-engine, Blueprint, question\
**Created:** [June 5, 2024, 2:55pm UTC](https://forums.unrealengine.com/t/center-of-rotation-issues-with-mouse-position-in-ue5/1890971 "2024-06-05T14:55:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guidogp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guidogp](https://forums.unrealengine.com/u/guidogp)\
**Post date:** [June 5, 2024, 2:55pm UTC](https://forums.unrealengine.com/t/center-of-rotation-issues-with-mouse-position-in-ue5/1890971/1 "2024-06-05T14:55:19Z")

</div>

Hello Unreal Engine community,

I’m encountering an issue with rotating a static mesh based on the mouse position in Unreal Engine 5. Specifically, I’m trying to have a static mesh rotate such that it always points towards the mouse cursor’s position in the world. However, the rotation appears to be incorrect, and the center of the rotation seems to be off.

### Issue:

Despite setting up these nodes, the static mesh does not correctly point towards the mouse cursor. The rotation appears to be incorrect, and the mesh’s pivot point seems to be offset. I have attempted various adjustments, including using `Subtract` nodes to calculate the direction vector and ensuring correct connections, but the issue persists.

### Request:

Could someone please help identify what might be going wrong with my current setup? Any guidance on correctly configuring these nodes to achieve the desired rotation based on the mouse position would be greatly appreciated. If there’s a more effective method to achieve this in UE5, I would love to hear about it.

Thank you in advance for your help!

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/a/6da4714af4b23c4212e432cb409da3ad6249c96a.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/6/d26161480d30613591b01c43d78003983a0b1ffd.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/0/480f002792e8893c3f88c30afbb44c1f8cb89680.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:** [June 5, 2024, 4:04pm UTC](https://forums.unrealengine.com/t/center-of-rotation-issues-with-mouse-position-in-ue5/1890971/2 "2024-06-05T16:04:38Z")

</div>

Your setup is missing depth (world direction). You may not be able to achieve _consistent_ results without fancier de-projection that accounts for camera frustum.

* * *

Consider this approach instead:

> [@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) …

Seems very close to what you need. You can skip the trace in the example, and use the `Intersection` as is.

---

<div class="post-metadata">

**Author:** ![guidogp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guidogp](https://forums.unrealengine.com/u/guidogp)\
**Post date:** [June 6, 2024, 12:36am UTC](https://forums.unrealengine.com/t/center-of-rotation-issues-with-mouse-position-in-ue5/1890971/3 "2024-06-06T00:36:46Z")

</div>

> [@Everynone](#):
>
> Your setup is missing depth (world direction). You may not be able to achieve _consistent_ results without fancier de-projection that accounts for camera frustum.

You are a genius. THANK YOU VERY MUCH!!!
