How to fix Gimbal Lock

My silly opinion, this isn’t caused by gimbal lock, it is caused because -180 to 180 degree rotation is a thing. When you get the find look at rotation it doesn’t understand the real difference between -180 degrees and 20 degrees. It thinks it is a difference of 200 degrees, which it is if you go the opposite way, but the other way is only 20.

You want to get the inverse rotation of the look at rotation and feed that into whichever shananigans you want to accomplish. Here is an example of working code that utilizes inverse rotation to bypass the issue.

Edit; A better explanation as to why it fixes it…

What you are doing now is asking… “My rotation is at 50 degrees currently, what should I rotate to if I want to look at the object?”

What you need to ask is, “Let’s pretend that my rotation is zero, what should I rotate to?” This way the answer is never to try and rotate from -160 degrees to 20 degrees.