I am trying to rotate an object around a global y-axis (basically yaw around 0,1,0 no matter what the current orientation is). I'd show a picture, but reputation... I want to rotate yaw around a global axis instead of the axis local to the object. For example if I slightly tilt a box via pitch, then try to rotate yaw, it will rotate the box at the tilted angle instead of straight as if the box hadn't been tilted at all.
Each object stores its position and rotation in a matrix that is updated every update call. The code for rotation looks like so:
D3DXMatrixRotationYawPitchRoll(&rotation, yaw, pitch, roll);
D3DXMatrixMultiply(&position, &rotation, &position);
where position is the outstanding matrix that is translated and rotated every update. This is what is rotating it locally, but I want to rotate yaw via a global axis.
How can I write it so that yaw rotation is completed as if the local up vector was (0,1,0) even if tilted?