Skip to main content
gamedev.net
🔒 Locked

rotating an object

Started by ribbonfish Jul 15, 2004 at 10:51 PM 1 replies 550+ views
Original Post
ribbonfish
ribbonfish
I rotate object O about x axis for 45 degrees. Then I want to rotate O about the y axis , the problem comes. I think the y axis here used in D3DXMatrixRotationY(&matRotY, 0.01f ); should still be the one pointing upwards. But apparently DirectX is rotating my O about the y axis that has been also rotated about x axis for 45 degrees. How to avoid this? Thanks
rohitgonsalves
rohitgonsalves
Oh yaa!

World axes are always fixed they never get changed until and unless you manipulate them according to your needs.

For your problem make sure for following things.

Set appropriate matrices.
Then used proper multiplication sequence if exists.
and then set the world matrix for your object.

Like
D3DXMATRIXA16 matWorld, matTemp;D3DXMatrixIdentity( &matWorld);D3DXMatrixRotationX( &matWorld, D3DXToRadian( 90 ) );D3DXMatrixRotationY( &matTemp, D3DXToRadian( -90 ) );D3DXMatrixMultiply(&matWorld,&matWorld,&matTemp);pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );


Changing multiplication sequence of D3DXMatrixMultiply(&matWorld,&matWorld,&matTemp); could cause reverse effect.

So be sure with your matrix setting and maintainance.


MOV AL, 0x00MOV AL, ME
__Daedalus__
__Daedalus__
The world axis do not change and there is nothing wrong with this line:

D3DXMatrixRotationY(&matRotY, 0.01f );

Post the relevant parts of your source code where your are doing the rotation and also the rendering. It is better than us trying to guess what you are doing.

Also you have started this topic three times on the main page! This is more than necessary!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.