given a quaternion ,solve the object 3 direction

Started by
3 comments, last by dotproduct 18 years, 4 months ago
or given a axis and rotate a object "angle" how to know 3 direction of a object? vector3 R = Funcion (axis,angle);
Advertisement
Get the rotation matrix, and pull out the 3 rows (direct3d) or columns (opengl) as vectors.. these vectors are your objects x,y and z axis.

PS: How did you get a user rating of 0?
Quote:Original post by dotproduct
Get the rotation matrix, and pull out the 3 rows (direct3d) or columns (opengl) as vectors.. these vectors are your objects x,y and z axis.

PS: How did you get a user rating of 0?



I often ask some simple question with poor english expression.
but I improve now :)
Quote:Original post by dotproduct
Get the rotation matrix, and pull out the 3 rows (direct3d) or columns (opengl) as vectors.. these vectors are your objects x,y and z axis.

PS: How did you get a user rating of 0?


Do you mean this?
	D3DXMATRIX m;	D3DXQUATERNION q;	D3DXMatrixRotationQuaternion( &m, &q );	m_x = D3DXVECTOR3( m(0,0), m(0,1), m(0,2) );	m_y = D3DXVECTOR3( m(1,0), m(1,1), m(1,2) );	m_z = D3DXVECTOR3( m(2,0), m(2,1), m(2,2) );
Quote:Original post by derek7
Do you mean this?
*** Source Snippet Removed ***


Yes.. that looks correct.

This topic is closed to new replies.

Advertisement