Hi everyone!
I've been using this code for years when setting up my world matrix for my meshes:
D3DXMatrixRotationX( &matRotX, Coords.Rotate.x );
D3DXMatrixRotationY( &matRotY, Coords.Rotate.y );
D3DXMatrixRotationZ( &matRotZ, Coords.Rotate.z );
D3DXMatrixScaling( &matScale, Coords.Scaling.x, Coords.Scaling.y, Coords.Scaling.z );
D3DXMatrixTranslation( &matTrans ,Coords.Position.x, Coords.Position.y, Coords.Position.z );
matWorld = ( matScale * matRotX * matRotY * matRotZ ) * matTrans;
d3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
However, my graphics guy has asked if he can have a system where if he rotates on an axis then it's sure to always rotate the same way regardless of other rotations applied.
For example:
If you have a Bike Wheel rotating on the Z Axis then it should still rotate correctly even if I rotate it on the Y Axis too. Currently using the above code it end up rotating the wrong way. I figured this is because of the order they are multiplied together. X then Y and then Z. But I don't just want to force the order the are multiplied for this specific case. How would I make it so that the Z Axis no matter what other rotations are applied will always make it spin the way you'd expect a wheel to spin?
Also, does anyone know if there is a technical term for what I am asking?
I would be grateful for any advice!
Thanks in advance for your time!
David