Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!