Skip to main content
GameDev.net gamedev.net
🔒 Locked

rotation problem.

Started by JBL May 12, 2003 at 10:36 AM 1 replies 350+ views
Original Post
JBL
JBL
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,
higherspeed
higherspeed
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''.
stevie56
stevie56
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.