Jump to content
• Advertisement

#### Archived

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

# Problem in Object Rotation

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

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

##### Share on other sites
Ok, got it solved now!

thx for the "big" help u gave to me... :D

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

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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13
• Advertisement

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013652
×

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