Funny rotations

Started by
0 comments, last by JohanK 22 years, 1 month ago
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
Advertisement
Solved it...

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

instead of

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

The order of the multiplication ofcourse...

This topic is closed to new replies.

Advertisement