PDA

View Full Version : Avoid Gimbal Lock, How?



RobertSI
10-24-2000, 08:27 AM
What causes gimbal lock and how do you avoid it?

Rob
10-24-2000, 09:34 AM
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.

Succinct
10-26-2000, 09:10 AM
definitely quaternions.

to help w/ the search.
http://www.cs.berkeley.edu/~laura/cs184/quat/quaternion.html
http://www.darwin3d.com/gamedev.htm#gdm0398

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

Antonio
10-27-2000, 07:48 AM
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?

Antonio

Bob
10-27-2000, 10:51 AM
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.

10-27-2000, 08:06 PM
gimbal lock is basically applying rotation/translation etc, in the wrong order (remember, order IS important), and you get undesired results.