Advertisement

rotation problem.

Started by May 12, 2003 10:36 AM
1 comment, last by JBL 21 years, 9 months ago
Hi, I have a camera thats using a quaternion to represent the orientation. From this quaternion im retrieving the up, right and direction vectors, like this: Matrix m; m_orientation.ToMatrix( m ); m_up = Vector3f( mat._12, mat._22, mat._32 ); m_up.Normalize(); m_right = Vector3f( mat._11, mat._21, mat._31 ); m_right.Normalize(); m_direction = m_right.Cross( m_up ); m_direction.Normalize(); When i''m still the direction is ( 0, 0, 1 ) as expected. Going down 90 deg gives me a direction of ( 0, -1, 0 ) which is fine. But if i''m rotating 90 deg to the right ( 1, 0, 0 ) and then going down 90 deg gives me a direction of ( 1, 0, 0 ) instead of ( 0, -1, 0 ) ??. I this a gimbal lock problem?? What im i doing wrong ? Can i retrieve the up, right, direction from the quaternion directly instead of using matrix math ? Cheers,
That isn''t a gimble lock problem. Are you sure you''re crossing the up and right vector the right way round? Just try it the other way round and see if it works.

I solve most of my problems by messing about with things like that. Of course you''ve got to have some understanding, or you''ll never get to the stage where you can ''mess around''.
Advertisement
Sometimes, though, it''s the ''messing around'' that leads to understanding?



Stevie

Don''t follow me, I''m lost.
StevieDon't follow me, I'm lost.

This topic is closed to new replies.

Advertisement