Freelance Controlls and Gimbal Lock

Hi,

I’m trying to code space flight-logic where the ship rotates towards the crosshair.

I followed this tutorial on freelancing controlls: Freelancer Style Mouse Controls Part 1: Making a Space Combat Sim in Unreal Engine - YouTube

This works but SetActorRotation causes gimbal lock. So I found this tutorial where the guy explains how to get rid of GL with C++: #gimbal #6DoF #quaternion Unreal Engine 4 Tutorial: 6DoF Fixing Gimbal Lock - YouTube
And this works aswell except from the following problem:

So instead of connecting the calculated rotation to the SetActorRotation-Node, I’m using the SetActorRelativeRotation-Node.

The two nodes EulerToQuaternion and SetActorRelativeRotation(Quaternion) are self coded exposed functions with C++ (see second tutorial. The code works still in UE 5.0.1 aswell).

The problem is, that it only works for the yaw. It rotates fine around the z-axis, but not for the pitch. Why is that? There is also a SetActorWorldRotation(Quaternion)-node. But it doesn’t work either.

Will Gimbal Lock be fixed in the near future inside UE5?

1 Like

I very much doubt the default rotation system will be shifted away from Eula math - it’s so much faster. But we might see some more built-in Quaternion routines…

2 Likes