PDA

View Full Version : moving a camera (quats?)



frogger
08-31-2000, 11:16 AM
I know this has probably been discussed before but what the hay http://www.opengl.org/discussion_boards/ubb/smile.gif

Say I am in the driver seat of a car and I want to move the camera (smoothly) to an overhead view.

Assuming I know the beginning and ending transformations how does one interpolate between the two?

I think I read that quaternions can do this (easily ha, ha http://www.opengl.org/discussion_boards/ubb/smile.gif) any help?

nikopol0
08-31-2000, 01:31 PM
a linear interpolation btw your 2 quaternioins will produce a smotther result than simply making a linear interpolation...
the only thing u have to do is to get the formula to transform your quaternion into a matrix
good luck !

paolom
09-01-2000, 06:09 AM
You can choose to do spherical linear interpolation, instead of linear interpolation. That was explained in an article by Jeff Lander (I think) of GDMag.
Found on the GDMag archives.

wolfman8k
09-02-2000, 09:39 AM
Interpolating the position is easy, just interpolate the x, y, and z values of the position.

It's interpolating the rotation that might be difficult. The real way is to interpolate each axe vector, but I think you might just be able to rotate your camera down a bit each frame since you just need the camera to move up and look a little down.

foobar
09-02-2000, 02:29 PM
If you use a 'lookat' function to aim the camera then you only need to interpolate the position. If you want the camera to come up to and off a velocity then the interpolation should be some funtion of time that will give the desired effect. eg:

position = start*(1-f(t)) + end*f(t)

As f(t) goes from 0 to 1 the camera moves from start to end.

You shouldn't use quarternions for camera interpolation because you can only fix the orientation of the camera through out in certain cases (of which yours is one actually http://www.opengl.org/discussion_boards/ubb/smile.gif ).

[This message has been edited by foobar (edited 09-02-2000).]