Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

3dZmaster

Problem in Object Rotation

This topic is 5464 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

This is the code I''m using a = m_fWorldRotX * sin(0-m_fWorldRotY); b = m_fWorldRotX * cos(0-m_fWorldRotY); // Matrix for the Main Character D3DXMATRIX matT, matR, matObj1; D3DXMatrixRotationY(&matR, 0-m_fWorldRotY); D3DXMatrixTranslation(&matT, 0-a, 0.0f, 0-b); D3DXMatrixMultiply(&m_matObj1, &matR, &matT); It moves fine, but it rotates around 0.0.0 I''d like to get it to rotate around it''s own axis. Anyone got solution?

Share this post


Link to post
Share on other sites
Advertisement
ok... Just finded out the rotation is fine. Something''s up with the translation.

here is the perfect code including the input statements:


if( m_UserInput.fAxisRotateLR )
m_fWorldRotY += m_fElapsedTime * m_UserInput.fAxisRotateLR;

if( m_UserInput.fAxisRotateUD )
m_fWorldRotX += m_fElapsedTime * m_UserInput.fAxisRotateUD;



a = m_fWorldRotX * sin(0-m_fWorldRotY);
b = m_fWorldRotX * cos(0-m_fWorldRotY);


// Matrix for the Main Character
D3DXMATRIX matObj1,matT, matR;
//D3DXMatrixTranslation(&matT, 0-a, 0.0f, 0-b);
D3DXMatrixTranslation(&matT, 3.0f, 0.0f, 0.0f);
D3DXMatrixRotationY(&matR, 0-m_fWorldRotY);
D3DXMatrixMultiply(&m_matObj1, &matR, &matT);


It is somehting in the sin and cos thing... SOMEONE PLZ!!!

Share this post


Link to post
Share on other sites
The matrix multiplication must be done in certain order to work as predicted. Find the matrix multiplication formula for explanation as to why.

kind rgds Nik

Share this post


Link to post
Share on other sites
...And Then I just texture the right places...?

edit: Sorry. Posted to the wrong topic

[edited by - 3dZmaster on October 5, 2003 11:01:31 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!