Through my research I’ve seena lot of people having Gimbal Lock issues using rotators in blueprint. I’m having a similar issue and haven’t found anything that helps yet. I can get close to what I want, but I get some gimbal lock flippy weirdness at the 180 mark. To articulate my issue, I made a video. It’s for a VR project. I don’t want to go into code just for this one issue, I’m pretty sure that it should be able to be solved in blueprint. I greatly appreciate the help!
Looking at the video, I get two hunches:
One, your “Roll” (or is it yaw? might be yaw) is always zero, which might cause some calculations error.
Second, have you tried rotating the entire object by 90 degrees and adjusting it’s model to fit?
I just fixed the rotation in Maya so that I can get rid of the -90 hack.
Roll was always nearly 0 in my debug text I had set up, so I just zeroed it out manually. I just tried another hack to see if the Absolute value of Yaw was > 100. If it was, I set both yaw and roll to 180 and keep the pitch. This is essentially what I want it to look like, but it pops at the 180. Just seems like it would be fantastic to get a “Use Quaterinon Rotation” Flag on the SetRelativeRotation or SetWorldRotation. Or on the Find lookat Rotation.
I fixed it. Essentially, I needed to use the Add Local Rotation Node instead of explicitly setting the rotation per-frame.
This is the formula I used (which I found here)
d = Dot(A,B);
C = Cross(A,B);
angle = acos(d);
dir = Dot(C,Vref); - ( The Vref is essentially a constant vector variable point positive 1, in the direction around where my Thrust Stick is rotating. Think of it like an axle on a car. In this case it was (0,1,0) )
if (dir is less than 0) angle = -angle;
And this is what it looked like when I converted it to blueprint.
Actually, this does fix Gimbal Lock, but it’s still processing Yaw in my “Find Look At Rotation” so if you move the vive controller from side to side while holding the stick, it affects the pitch of the stick’s rotation and the stick eventually moves out of synch with the controller. So, I’m still investigating how to fix this. I imagine it’s going to be a hack. I’m amazed that this is so hard in the “all powerful” blueprint.
Any luck @CharlieTheTall