# Fixing gimbal lock, mouse position based rotations

**URL:** <https://forums.unrealengine.com/t/fixing-gimbal-lock-mouse-position-based-rotations/472705>\
**Category:** Community & Industry Discussion\
**Tags:** flying, unreal-engine, mouse-position, question\
**Created:** [October 10, 2020, 10:26am UTC](https://forums.unrealengine.com/t/fixing-gimbal-lock-mouse-position-based-rotations/472705 "2020-10-10T10:26:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_a1476126](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a1476126](https://forums.unrealengine.com/u/anonymous_user_a1476126)\
**Post date:** [October 10, 2020, 10:26am UTC](https://forums.unrealengine.com/t/fixing-gimbal-lock-mouse-position-based-rotations/472705/1 "2020-10-10T10:26:13Z")

</div>

![318039-mousesetup.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/4/2c4ed21278d6dfd7ee9dcf9f62ced83e221d148c.jpeg)

Hello everyone,  
I have a flying ship that rotates around the 3 axis based on the position of the mouse on the screen. Everything works great until the pitch is 90/-90 where I am assuming I hit gimbal lock and the ship and camera start shaking really badly preventing me to invert the ship. I have a general understanding of what gimbal lock is and I know quaternions are not immediately accessible in blueprints. I found a few solutions in C++ and a library for quaternions on the marketplace but I am struggling to apply these solutions specifically to my case. I was wondering if anyone could point me in the right direction and help me out. I apologies if I just miss something obvious, still pretty new to programming in UE4  
Thank you.
