I have the following question. I have programmed the rotation of the object dependent from the mouse movement. This works. But know I want to make the "object movement" by rotating the camera instead of rotating the object because I need this for a new program code because it would make this program code simplier.
The problem is how to make the rotation of the camera movement? When I have a movement in x-direction and a movement in y-direction of the mouse then I have written the following code:
m_Camera->setRotation(mouseRX, mouseRY, status); temp_rot = m_Camera->getRotation(); rot1 = m_Camera->getLength() * cos(temp_rot.y) * cos(temp_rot.x); rot2 = m_Camera->getLength() * cos(temp_rot.y) * sin(temp_rot.x); rot3 = m_Camera->getLength()* sin(temp_rot.y); m_Camera->SetPosition(rot1, rot2, rot3); m_Camera->SetLookVector(nullvector - m_Camera->GetPosition());
So I calcuate the kartesian coordinates (rot1, rot2, rot3 ) which are the x,y,z coordinates and set the position and look vector. This works when one of the angles is zero, but if both of them aren't zero then it does not work. Can anyone help me with this problem?
Thanks a lot.