openlearner

05-21-2013, 12:07 AM

I like Euler rotation based on degrees so I can keyframe an animation of a large number of degrees, like 1000, and get multiple full 360-degree revolutions on the object for purposes of setting it spinning, etc.

However I'm at a point now when I was working on something that involved a lot of consecutive animations among two different axes that I think I'm seeing the effects of gimbal lock. When I perform one of the chained animations, my object keeps flipping 180 degrees after it completes a 90-degree rotation. Does this sound like gimbal lock? It only happens after other prior and successful rotations along different axes.

In any case, I tried switching to Quaternions but it appears that quaternions aren't suited for this spinning effect, since they just get you an orientation and they treat a multiple of 360 as 0 using this:

template <typename T>

inline QuaternionT<T> QuaternionT<T>::CreateFromAxisAngle(const Vector3<T>& axis, float radians)

{

QuaternionT<T> q;

q.w = std::cos(radians / 2);

q.x = q.y = q.z = std::sin(radians / 2);

q.x *= axis.x;

q.y *= axis.y;

q.z *= axis.z;

return q;

}

Is it possible to get more than 360 degrees of rotation from a quaternion technique?

However I'm at a point now when I was working on something that involved a lot of consecutive animations among two different axes that I think I'm seeing the effects of gimbal lock. When I perform one of the chained animations, my object keeps flipping 180 degrees after it completes a 90-degree rotation. Does this sound like gimbal lock? It only happens after other prior and successful rotations along different axes.

In any case, I tried switching to Quaternions but it appears that quaternions aren't suited for this spinning effect, since they just get you an orientation and they treat a multiple of 360 as 0 using this:

template <typename T>

inline QuaternionT<T> QuaternionT<T>::CreateFromAxisAngle(const Vector3<T>& axis, float radians)

{

QuaternionT<T> q;

q.w = std::cos(radians / 2);

q.x = q.y = q.z = std::sin(radians / 2);

q.x *= axis.x;

q.y *= axis.y;

q.z *= axis.z;

return q;

}

Is it possible to get more than 360 degrees of rotation from a quaternion technique?