Mesh Coordinates

Started by
1 comment, last by sansured 18 years, 6 months ago
Hi, I have some problems about mesh coordinates and rotating it. First i set the coordinates(D3DXMatrixTranslation -400, 1, 200) after that i try to rotate the mesh with(D3DXMatrixRotationX).It's ok until now but mesh rotates around the origin(0, 0, 0).I want the rotation around mesh's origin (-400, 1, 200).


D3DXMATRIX matXRotation, matYRotation, matZRotation, matCoordinate,  matWorld;


D3DXMatrixTranslation( &matCoordinate, -400, 1, 200 );


D3DXMatrixRotationX( &matXRotation, m_XRotation);


D3DXMatrixRotationY( &matYRotation, m_YRotation);


D3DXMatrixRotationZ( &matZRotation, m_ZRotation);


D3DXMatrixMultiply(&matWorld, &matXRotation, &matYRotation); 


D3DXMatrixMultiply(&matWorld, &matZRotation, &matWorld); 


D3DXMatrixMultiply(&g_mCenterWorld[nObjectnum], &matCoordinate, &matWorld);



What am i going to do for fixing the problem?
Advertisement
You should rotate first and translate afterwards, I guess...
If i rotate first and than translate.
Mesh goes to point of origin (0, 0, 0) not coordinates which i gave (-400, 1, 200).

This topic is closed to new replies.

Advertisement