I have camera class that hold her orientation via euler angles and position. Something like that:
float m_x;
float m_y;
float m_z;
Vector4 m_pos;
And i want to move this camera free over the space. When user move mouse up-down camera must rotate around x axis in her own coordinate system. But i want to hold only this three angles and position and nothing more.
So algorithm looks like this:
- Find camera local system axis (u, v, n)
- Rotate around u axis on angle alpha
- Find angles around (1, 0, 0), (0, 1, 0), (0, 0, 1) that answer to rotation on angle alpha around u axis
- Add them to m_x, m_y, m_z
Question is: how can i calculate rotation angles in default coordinate system (i mean in (1, 0, 0), (0, 1, 0) and (0, 0, 1)) that answer to rotation angles in local camera coordinate system?
Or may be better solution exists for this problem?
her
throughout the text? Besides that you're trying to do will net you a result which you most likely don't want, look up gimbal lock. – Ylisar