# Converting Vectors or Euler angles to Quaternions

This topic is 607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633678
• Total Posts
3013292
×