Vehicule Movement : Gimbal Lock , update ?

Hello Everyone,

Yellow Sign : long post ahead, prepare to bear with me :slight_smile:

I know this issue has been raised many times in the past, but it seems that this issue (pitch locking at 90° and gimbal lock stuff) has been completly forgotten since summer 2014.
I didn’t found any BP answer as to how to avoid that on existing threads, and no update since then.
So here I am, reviving an old thread.

My project wants to have a vehicule that could fly around and follow some ground shapes.
those shapes could very well be loops, tunnels or pipe gooing up and down, backward and so forth, something futuristic .
I’m using some interpolation between the surface normal and the vehicule’s normal to smooth everyting up and get a nice feeling of glide over the ground.

I only do BP now, cause I’m a lazy dude not willing to div again into C++.
I got it all pretty much done as long as th ground does not tilt over 90° (or -90°).
And of course thing get complicated when you cross the limit.

I tested AddActorLocalOffset, wich seems to overcome this limitation. But it’s not my prefered solution because I would have to rework all my calculations to compute a rotator between target and current instead of just interpolating.
Still it’s a solution.

So do you guys, devs, not devs, mathematicians and folks like me that didn’t pratice math for a lont time, have any tips for my problem ?
Is there a way to bypass gimbal lock now ?
I though of converting rotator to Quats, computing rotation, then convert back to Rotators.
But Quats doesn’t seems to have been exposed as BP since 2014, so even if I wanted to, BP are too limited on this part. Or at least, there is no usefull math BP nodes like for Rots and Vectors.

For my backup plan (compute a delta rotator bewteen rotators) I’m having trouble figuring out how to do that.
any BP example would be most appreciated.

Another info, the only axis that matters to me is the Yaw axis, the one telling what direction I’m going; the other two axis are just following the ground normal or tilted a little when free falling (can be deactivated).

I’m kinda stuck here, so I rely almost entirely on a good soul :slight_smile:
I’d hate to limit my game because of this.

Thanks in advance.