Suppose I have a first person camera and a model. The camera is placed where the head is, as a placeholder.

Suppose I want to rotate the camera about the model's z axis(imagine a first person game where you tilt your head slightly to the right to see if there are enemies after the corner).

BUT the camera's position AND coordonate axes must be rotated.

So,I just have to create a rotation matrix that rotates around the model's z axis:

D3DXMatrixRotationAxis( &mtxRotate, &m_model->zAxis, D3DXToRadian( degrees to rotate ) );

Now,what I don't understand is: the answer says that in order for everything to work properly, I have to subtract the model's position from the camera position,so they end up at the same origin,rotate that new position from which i subtracted,and then add the model position back to the camera position,thus,the rotation will work correctly.

BUT I don't understand,didn't I create a matrix that rotates around a certain vector? Why isn't that enough?

And if I have a model at: 1,2,4 and a camera at 1,6,4, the subtraction will only give me: 0,4,0 how is that the same origin?

**Edited by noatom, 31 January 2014 - 10:14 AM.**