PDA

View Full Version : Automated Camera Movement



ThinIce
03-28-2002, 08:41 PM
Hello,
I am looking for information on automated camera movement, Like a demo that mvoe the camera for the user, all the user does is sit back and watch.

IE: camera moves at X speed, on X Vector, and then changes speed and vector.

Just camera movement. Anyone know of a good resource which covers such a thing, or a good place to look at? Any help is much appreciated.

chxfryer
03-29-2002, 08:50 PM
you could always just write a program where you control the camera and move it around. The have a button that creates keyframes in a file (saves direction of camera and position) then in your game/demo, load the file, and interpolate between the keyframes. Can even use beizer curves (a tutorial on www.gametutorials.com) (http://www.gametutorials.com)) so the movement is even smoother

[This message has been edited by chxfryer (edited 03-29-2002).]

ThinIce
03-30-2002, 11:05 AM
Ya, that sounds like a good idea. Sounds a litle complex though. On a demo I got from NeHe, A guy used path files for the camera, But, Could you fill me in a bit more about keyframes though? Or do you have any resources you could point me in? Any help is much appreciated!

chxfryer
03-30-2002, 02:29 PM
Originally posted by ThinIce:
Ya, that sounds like a good idea. Sounds a litle complex though. On a demo I got from NeHe, A guy used path files for the camera, But, Could you fill me in a bit more about keyframes though? Or do you have any resources you could point me in? Any help is much appreciated!
A path file is kinda like what I was talking about except with keyframes you dont store the position/direction of the camera every frame. Just certain frames you could say.
For instance you wanted the camera to move forward 10 units, then turn right 90degrees, then forward another 10 units WHILE turning back left 90degrees.
ok, in the program (to make the keyframes), position the camera where it will start and press your designated keyframe button. It will save that position to the file. Then move forward 10 units and keyframe button again. Turn camera right 90degrees. Keyframe button again. Move forward 10 units again then turn back left 90 degrees and THEN keyframe button.
As you can see, you make keyframes where you want the camera to be and where you want it looking at a certain point. Sorry if thats confusing, I couldnt think of a better way to write it.
Now in your program/demo/whatever, load the animation file. Load up the first frame (where the camera starts off) and set the variables. Then Interpolate
kinda like

keyframepos = next keyframe position
campos = camera position
keyframedir = next keyframe camera direction
camdir = camera direction

// Dont calculate these 2 lines every frame
// or it will never reach destination
deltapos = (keyframepos-campos)/(frames to do it in)
deltadir = (keyframedir-camdir)/(frames to do it in)
campos+=deltapos;
camdir+=deltadir;

Now where I was talking about beizer curves, the keyframes arebasically control points that define a curvy line. I think...dont know too much, just seen the tutorial on http://www.gametutorials.com

ThinIce
03-30-2002, 02:51 PM
Yeah, I kinda get the idea, but the thing that confuses me is

A: How would I store my data?

IE: What handlers would I store upon the press of the keyframe button?


B: How would I read the data?

IE: How would I read and make the saved data work for me?

I am starting to get the idea, but these 2 questions are my difficulty.