Sign in to follow this  

Converting Vectors or Euler angles to Quaternions

Recommended Posts

Case 1:
D3DXVECTOR3 vNewDir = l_transform->m_MotionInfo.m_vEndDir;
D3DXMATRIX matTemp;
                        
D3DXMatrixTransformation(&matTemp, NULL, NULL, NULL, &vNewDir, NULL, NULL);
D3DXQuaternionRotationMatrix(&qEnd, &matTemp);
Case 2:
//D3DXQuaternionRotationYawPitchRoll(&qEnd, vNewDir.x, vNewDir.y, vNewDir.z);

In case 2, where vNewDir == (1,0,0) which is pointing to the EAST,

The D3DXQuaternionRotationYawPitchRoll will make the object pointing UP to the EAST inclinedly

Is case 1 correct anyways?

My vectors (not eulers) by the way, are something like (1,1,0) which basically unnormalized.

I am just hard coding into these. like when the planned direction is NORTH-EAST-UP,

I just hard code into a vector like (1,1,1) and just leave it till the end, and I think

I would handle it in the process movement stage....

 

I ever thinking about converting the vectors into euler's angles like this

atan2f(v.z, v.x);

but I hate the idea that I have to handle the infinity situation which gives no results...

Any pointers?

 

UPDATE1:

SORRY FOLKS, I THINK I AM HAVING A BUG IN MY PROGRAM!!!!!

I AM TESTING THE YAW, PITCH, ROLL STUFF IF THAT WORKS...

 

UPDATE2:

Once Again, I changed my mind, the Yaw Pitch Roll with (1,0,0)

does change the orientation of the object to upwardly inclined....

The expected result was something pointing to the EAST flat!

Any quick fixes for this?

 

UPDATE3:

I think I've solved it

I believe I need to interpolate the orientations instead of rotations....

 

UPDATE4:

Sorry, Still don't work....

The thing is I need to convert a direction vector into euler angles, which isn't a prevalent discussion on the net

 

 

 

Thanks

Jack

Edited by lucky6969b

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this