PDA

View Full Version : Trackball and panning



cassebrik
10-29-2003, 04:07 AM
Hi !

Is anybody has an example of mixing trackball (rotation with mouse on virtual sphere and quaternions) and simple pan (translate scene with the mouse) ?
I get ugly results with rotating around wrong axe when I translate my model.
The rotation is around old center and not around new center.
I tried all orders for the matrix (rotate/translate and translate/rotate).

Thanks !

Relic
10-29-2003, 06:15 AM
Try this (matrices are left multiplied in OpenGL, read from bottom to top.)

modelview
+translate (to object location)
rotate (in origin)
-translate (moves center of rotation to origin)
draw object

cassebrik
10-29-2003, 11:33 PM
I found it !
My camera works properly now !
It was a mistake for evaluate the "world" vector during panning.
Thank you !