PDA

View Full Version : Automatic Tour (camera question)



workgameproper
04-23-2008, 02:41 PM
I have a 3D football field that I have developed and the user is allowed to move the camera freely throughout the scene. By using the keyboard and pressing letters such as 'a' or 's', it will update my lookAt function and will allow the camera to move through the scene. I have this working fine and is not the problem. The problem is that I want to create an "Automatic Tour" through my scene. For instance to change the camera position to around 3 or 4 different positions to show off some different views. I would like the user to press the letter 'k' and this tour happen. However, I cannot figure out a good way to accomplish this. I have tried updating my lookx, looky, and lookz variables which in turn are used by glLookAt(lookx,looky,lookz,.....); But it goes so fast that it seems I am only doing 1 view. Does anyone have any recommendations on how to accomplish the feeling of an automatic tour (the camera moving through the scene on its own). Thanks in advance!!

workgameproper
04-24-2008, 01:37 PM
Is this question not clear or are there no recommendations? Thanks.

-NiCo-
04-24-2008, 03:17 PM
Maybe you need to add some timer functions to make the speed of your movement independent of the frames per second so that it moves equally fast on slow and fast machines.

Zengar
04-24-2008, 03:24 PM
Basic solution: program your camera transformation as a function of time. This way you will get same animation speed on every machine.

workgameproper
04-24-2008, 03:55 PM
Basic solution: program your camera transformation as a function of time. This way you will get same animation speed on every machine.
How do I go about doing this??

Zengar
04-24-2008, 05:49 PM
Well, you can define a path along which your camera moves (for example, as a curve or a set of lines). Then, if you have the velocity, you can determine the camera position in a particular time point. The camera direction is pointed towards the path. I am sure you will figure it out from now on, this shouldn't be that hard. I would gladly supply you with some code, but I have never done anything like that ; as a matter of fact it has been some years since I last worked with 3d graphics...