What causes gimbal lock and how do you avoid it?
Avoiding it is best, but if you’ve already got it, I think that Johnson and Johnson make a cream that will clear it up…
Sorry about that.
Seriously. Gimbal lock is caused when you get your rotational axis into a configuration where you don’t really have three independent degrees of freedom anymore. The rotational axis are only independent as long as they stay orthogonal to each other. The typical solution is to use quaternions, which I won’t attempt to explain, but you should be able to do a search and come up with some explanations.
the former is a technical description, while the latter is an actual implemenation by jeff lander
i recommend the latter, as jeff lander is the man
I understand Bob’s definition of Gimbal Lock, however how can you achive that in OpenGL? Is it possible to get a gimbal lock only with translations, rotation and scales?
Gimbal lock is an issue when messing with Euler angles ONLY, and has nothing to do with matrices or OpenGL. One solution is indeed quaternions, but why use quaternions? They don’t give you anything you can’t do with matrices. And remember, when using quaternions, you have to convert them to matrices to use them in OpenGL, so why not stick to matrices in the first place, and skip this conversion?
Gimbal lock occurs when you are using rotations in the wrong (or a not-so-smart) way.
gimbal lock is basically applying rotation/translation etc, in the wrong order (remember, order IS important), and you get undesired results.