Problem in Object Rotation

Started by
3 comments, last by 3dZmaster 20 years, 6 months ago
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?
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
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!!!
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
Ok, got it solved now!

thx for the "big" help u gave to me... :D
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...
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

Niko Suni

...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]
Woe to you, oh earth, and sea, for the devil sends the best with wrath, because he knows the time is short. Let him who hath understranding reckon the number of the beast, for it is a human number. Its number is 10011101101010110100110100101010101000101110100110100101010010100101101010101011...

This topic is closed to new replies.

Advertisement