In my code I am trying to run two (at the moment, probably more in the future) matrix transformations on my world matrix. Like so:
D3DXMatrixRotationY(&worldMatrix, rotation);
D3DXMatrixTranslation(&worldMatrix, 0.0f, -1.0f, 0.0f);
where rotation is a changing float and worldMatrix is a D3DXMATRIX. My problem is that only the last line of code in the transformation statements works. So in the above code, the worldMatrix would get translated, but not rotated. But if I switch the order of the two statements, the worldMatrix will get rotated, but not translated. However, I played around with it, and this code works just fine:
D3DXMatrixRotationY(&worldMatrix, rotation);
D3DXMATRIX temp = worldMatrix;
D3DXMatrixTranslation(&worldMatrix, 0.0f, -1.0f, 0.0f);
worldMatrix *= temp;
After this, the worldMatrix is translated and rotated. Why doesn't it work if I only use the variables and don't include the temp matrix? Thank you!!