Hi !
I've some troubles with my camera class.
I use quaternion to performe rotation (interactive rotation on unit
sphere with mouse).
It works.
But when I translate scene, the rotation seems occur around old center
of scene and not the new center (translated).
double dist = Distance();
// Init matrix (unity)
m_Transform.Unit();
// Apply translation of camera
m_Transform.ApplyTranslation(m_CenterSceneRef.U(),
m_CenterSceneRef.V(),
-dist);
// Apply rotation of camera
m_Transform.ApplyRotation(m_CameraOrientation);
// Apply translation from center of model
m_Transform.ApplyTranslation(-m_CenterScene);
// Compute inverse matrix
m_InvTransform = Invert(m_Transform);
// Model Matrix
glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(m_Transform.GetArray());
The question is quite simple: how to perform the rotation around the
new center (translated) ?
Of course I tried to change order of operation. But nothing seems to
work.
Any idea ?
Thanks
|
|
0
|
|
|
|
Reply
|
cassebrik
|
10/28/2003 9:16:02 AM |
|