Skip to main content
GameDev.net gamedev.net
🔒 Locked

Camera Path

Started by levjs Apr 7, 2006 at 3:56 PM 10 replies 3.5k views
Original Post
levjs
levjs
Hi, How would you create a predefined path for the camera to move on? That may have sounded dumb the way I put it, but I have no idea of any methods used for this. Thanks alot. Levi
Palidine
Palidine
You could use splines. They're basically curves that are fit to a series of waypoints. The curviness can be manipulated in different ways. Here's a fun little page that gives a nice overview:

http://www.cse.unsw.edu.au/~lambert/splines/

-me
levjs
levjs
So you would calculate the points on the spline, then have the camera move through them? Is that correct?
Thanks
Levi
Zakwayda
Zakwayda
Quote:
Original post by levjs
So you would calculate the points on the spline, then have the camera move through them? Is that correct?
There are lots of different ways to do it. For example, you often want to use arc length reparameterization so you can control the speed of the camera more carefully. There are also various issues to consider related to orienting your camera as it moves along the curve.

As far as your curve goes, the most basic requirement is to be able to evaluate the position at a given parametric value t. With that, you could do a very simple 'camera follows curve' implementation using gluLookAt() or its equivalent, using the position corresponding to t and the position corresponding to t+h, where h is the step.
levjs
levjs
Hi,
Thanks for the responses. I know now what I must do, I now need a push(or maybe a big shove) in the right direction. [smile] Are there any tutorials out there on this(I've looked without much success). How I understand it, I mush create a spline, and move the camera along it. What are some equations for creating splines like that? Also, of the spines mentioned in the above link, which would better suit my purpose. Thanks so much.
Levi

[Edited by - levjs on April 18, 2006 11:44:13 AM]
klette
klette
http://ibiblio.org/e-notes/Splines/Intro.htm This site has quite alot of useful info ;)

Good luck :)
levjs
levjs
Which of those splines should I use to control the camera? I really have no idea what I'm doing here. [smile]
Levi
klette
klette
Depends on the what kinda movement you want.. You're just moving your camera along the path.. The splines just gives it nice coords for its travels ;)
levjs
levjs
Rating++ for the helpers. [smile]

Wow, I've done it. With you and the help of some other code in which it was demonstrated, I took it apart, understood it, and wrote my own program. I must say, it wasn't as complicated as I thought it would be.

Can someone explain what tangents and normals to the curve would be useful for....

Now, I know this has no relation to any of it, but can any of you point me to a place that could explain matrix math. Is matrix math supposed to be taught in algebra 1 or 2, or what?, because I didn't get it in Alg1,Alg2, or Geometry. Or is it a more specialized math that you have to pick up yourself?
Thanks so much.
Levi
oggialli
oggialli
Matrices are introduced in linear algebra (most probably).
Olli Salli
levjs
levjs
One more thing. When I have the camera follow the bezier curve, it works fine. However, when I rotate the scene, everything rotates, but I am no longer on the bezier curve, I am on the same path. What can I do to fix this.
Thanks
Levi

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.