# Pitch rotation problem with FindLookAtRotation function 

**URL:** <https://forums.unrealengine.com/t/pitch-rotation-problem-with-findlookatrotation-function/2453602>\
**Category:** Character & Animation\
**Tags:** unreal-engine, question\
**Created:** [April 12, 2025, 10:56pm UTC](https://forums.unrealengine.com/t/pitch-rotation-problem-with-findlookatrotation-function/2453602 "2025-04-12T22:56:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benderonny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Benderonny](https://forums.unrealengine.com/u/Benderonny)\
**Post date:** [April 12, 2025, 10:56pm UTC](https://forums.unrealengine.com/t/pitch-rotation-problem-with-findlookatrotation-function/2453602/1 "2025-04-12T22:56:46Z")

</div>

Hello everyone! Can you please help me with this?

I’m trying to create a 2D platformer where player can shoot at any angle (not just 8 direction like in a classic games). My decision was to separate the player character sprite to two - lower body and upper body. The upper body sprite should follow the mouse in 360 degree range.

To calculate the rotation angle of the upper body sprite I use GetHitResultUnderCursorByChannel and trace my mouse to the plane just behind the character (the result is represented as red debug sphere on video)

Then I use FindLookAtRotation with ActorLocation as a starting point (green debug sphere on video) and my mouse hit result location as target point. Then I use Y(pitch) value from the result to set my upper body sprite Y angle.

With all that I get very strange angle values (see the video, angle is printed). This same logic works well with rotating on Z axis so I admit the gimbal lock problem here. I saw this topic

[How can I avoid Gimbal Lock with Rotations?](https://forums.unrealengine.com/t/how-can-i-avoid-gimbal-lock-with-rotations/286881)

but I’m not sure how to apply that solution to my problem and if it’s the case at all.

So the questions are:

1. How can I solve this problem and get normal angle values from 0 to 360 or something?
2. Is this even a good logic for such a gameplay mechanic?

Thanks

Video - [record\_2025-04-13\_00-07-15.mp4 - Google Drive](https://drive.google.com/file/d/1f41LxEwbpfNsabUNqgw_JxLXlTK-bVNw/view?usp=sharing)

Angle calculation function

 ![CalculateAngleFunction](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/1/091c1a6a6b40cb21cb46a129e82b2c9bec9e61ce.jpeg)

---

<div class="post-metadata">

**Author:** ![Benderonny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Benderonny](https://forums.unrealengine.com/u/Benderonny)\
**Post date:** [April 14, 2025, 5:41pm UTC](https://forums.unrealengine.com/t/pitch-rotation-problem-with-findlookatrotation-function/2453602/2 "2025-04-14T17:41:55Z")

</div>

Somehow I managed to get the right 0 to 360 angle values. Problem was in how FindLookAtRotation result behaves.

This is the working function for calculating the angle. Maybe it will help someone.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/7/377b93ced72424541413cb3c533574737cb622fe.png)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 14, 2025, 5:42pm UTC](https://forums.unrealengine.com/t/pitch-rotation-problem-with-findlookatrotation-function/2453602/3 "2025-05-14T17:42:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
