This topic is now archived and is closed to further replies.


flying over terrain

Recommended Posts

anyone got any ideas or ways to point me on how to make a fly by over a terrain. Im making a demo where initially I want to fly slowly through some terrain and trees etc and end up at a specific point... hmmm it seems simple but every time I go to start the fx, I cant think about it properly, having some trouble visualizing it. CHEERS! Im just a beginner!!!

Share this post

Link to post
Share on other sites
well, using a vector to get your camera orientation might work...
then you could calculate that vector every frame using a smooooth sine function and add it to your current position

Share this post

Link to post
Share on other sites
Here's a way:

Set up a series of points that define the path over your terrain, and the rotation you want the camera to have when you reach each point.

Now code for the camera to follow those points.

Then work on smoothing out the turns and making the camera angles more effective in displaying your terrain to the user.

[edited by - Waverider on August 30, 2002 4:52:15 PM]

Share this post

Link to post
Share on other sites
Aye, you could have a ''cx, cy, cz'' and a ''canglex, cangley, canglez'' to define you''re camera, and when drawing, you could just do this...

glRotatef(canglex, 1.0f, 0.0f, 0.0f);
glRotatef(cangley, 0.0f, 1.0f, 0.0f);
glRotatef(canglez, 0.0f, 0.0f, 1.0f);

As waverider suggested, you could have a ''cinematicpoint'' list for your demo, here''s a structure that I think would be enough for what you''re trying to do with the camera...

typedef struct CinematicPoint {
float x, y, z;
float xangle, yangle, zangle; // New xangle, yangle, zangle
} CinematicPoint;

And then you could have a ''cinematicline'' that will connect the two CinematicPoints for animation...

typedef struct CinematicLine {
CinematicPoint *start, *finish;
float speed; // How fast it will move through...
} CinematicLine;

Then you can just move the camera between the two points start, and finish at a constant speed...

To rotate the camera, you can use the following equation...

canglex = (start->xangle-finish->xangle)*(distance(start, end)/distance(start, currentcameraposition))+start->xangle;

cangley = (start->yangle-finish->yangle)*(distance(start, end)/distance(start, currentcameraposition))+start->yangle;

canglez = (start->zangle-finish->zangle)*(distance(start, end)/distance(start, currentcameraposition))+start->zangle;

Hope that helps a bit..


Share this post

Link to post
Share on other sites