Archived

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

JohanK

Funny rotations

Recommended Posts

Hi, I''m trying to create bounding boxes around my objects. Got a model class with the main mesh, and a boundingbox mesh to represent the box. In the render loop I have something like this { m_pModel->Render(); // Render the main object D3DXMATRIX matTemp; D3DXMATRIX mat; // Rotate the box D3DXMatrixRotationY( &mat, D3DXToRadian( m_heading ) ); // Put the box inplace D3DXMatrixTranslation( &mat, m_x, 30, m_y ); // Multiply the matrixes(?) D3DXMatrixMultiply( &mat, &mat, &matTemp ); ... } The result is that the boundingbox is mirrored on both x and z axis (y is always 0 in this case) If I remove the rotation and the multiply, the box is drawn correctly inplace? What did i miss on matrix multiplication? /Johan

Share this post


Link to post
Share on other sites
Solved it...

D3DXMatrixMultiply( &mat, &matTemp, &mat );

instead of

D3DXMatrixMultiply( &mat, &mat, &matTemp );

The order of the multiplication ofcourse...

Share this post


Link to post
Share on other sites