Advertisement

how to create gimbal lock

Started by July 19, 2002 11:15 AM
2 comments, last by Dreamforger 22 years, 7 months ago
In order to avoid creating gimbal locks, I want to be able to create them, understand them. Problem is I fail abysmally. The symptoms of gimbal lock as I understand it are that after some rotations around one axis, following rotations about the other two axis look the same or at least inverted. This can only be achieved by letting the latter 2 axis (or is the plural axises?) be parallel. I read a GameDev article which said that this comes about by using Eulerangles and matrices. Each Eulermatrix rotatates about 1 axis. Rotations about more than 1 axis is achieved by multiplying E-Matrices. Eulermatrices are orthonormal therefore the original orthogonal basis of our coordinate system gets transformed into another orthogonal system after multiplication. And orthogonal systems have no two parallel axis. It is true that there are two (or more) triples of angles that when entered into Euler matrices give the same result, but that was not described as gimbla lock. If you always rotate about the world coordinate system, gimbal lock cannot appear either as the world coordinate system obviously has no two parallel axis. The only way to create gimbal lock as I understand it is mixing the two methods of rotation. But mixing the two is like mixing beer and wine and complaining that it tastes bad ( I never tried, have you?). --------------------------- I may be getting older, but I refuse to grow up
I may be getting older, but I refuse to grow up
OK: Rotate first on the x axis, then on the y, then on the z.

Because of they way we''re composing rotations, the axis used for the y rotation has already been rotated by the x.

Say I rotate however much around X.

Then I do a 90 degree rotation about Y. If my X/Z axes looked like this:

 ^ Z | | |-----> X 


They now look like this:

 ------> Z | | | \/ X 


Now, when I rotate about Z, it looks as if I''m just doing extra rotation around X!

At least, I think that''s an example of it. I always use axis-angle rotation, so I don''t have to worry about gimbal lock much.

Advertisement
To simulate gimbal lock try interpolating using Euler angles.

A major problem with Euler angles is there are certain rotations that have multiple representations. When interpolating through such an orientation there is not a unique solution as the rotation passes through it. This point is called a singularity.

In some games with fixed third person cameras based on rotation angles as the player moves directly under the camera it snaps between views as it cannot interpolate smoothly through the singularity at ''straight down''.

Physically this manifests itself as gimbal lock in systems that rotate like Euler angles, such as cameras and camera stands. Such may have limits to their rotation so they cannot get stuck in such orientations, e.g. they may be unable to look straight up or down.

John BlackburneProgrammer, The Pitbull Syndicate
Many thanks to the both of you. Embarrasing as it was to ask, the answers were worth it!
------
I''m growing up
I may be getting older, but I refuse to grow up

This topic is closed to new replies.

Advertisement