   Moving a camera through preset path nodes.
  Hi all, Im trying to make a simple 3d tube racing game in directx8 and Im stumped on how to get the camera to traverse nodes properly. I have placed nodes in a line down the centre of each tube segment, currently the track has two straights and two turns, like an nascar oval. the camera moves from node to node, that works ok. but I dont know how to get the camera to look at a point, x distance in front of it, on the vector it''s travelling along. I can only get it to look at the next node, which causes a really ugly ''snapping'' every time a node is reached, and just looks shit basically.Im fairly new to all this so Im probably out of my depth. I guess my question is that if I have a vector between the camera position and the next node, what sort of maths do I need to do to set the camera look at argument of D3DXMatrixLookAtRH in the direction of movement, or better still interpolate between the nodes using quarternions (something I know nothing about).thanks, sorry if this is lame.Bootis. 
  When the camera is a set distance to the node, start turning it so it looks towards the next node. This way the pan would be failry smooth and not just snap to the new node. ;  Use keyframe animation on your nodes.You have a list of notes, each with a "time" and a position. To move around the track you increase the "time" and figure out between what to points it is then you use this equation:out = a + (b-a) * iWhere a is the node just behind you, and b is the node right befor you and i is a value between 0 and 1 figured out by:i = (time - a.time) / (b.time - a.time)This is called linear interpolation, if you would use bezier (sp?) you could use less nodes and get a smoother affect, linear will travel along a straight path between points so a smooth look woudl require lots of points.Anyways, to your question, all you would have to do is figure out the cameras position as time, and figure out the camera looking at position as time + someconstant.Or if its a 3rd person camera why dont you set the camera looking at position to the cars position and just move the cameras from position along this node track? ;  It is probably a good idea to start on linear interpolation as honayboyz said.If you want to go on to something like Bezier here is a quick equation:p is a point: 4 are needed.s is your interpolation time.  When s = 0 you are exactly at the first point and if s = 3 you are exactly at the 4th point.FinalPosition = p[0]*(1-s)^3 + p[1]*3s*(1-s)^2 + p[2]*(3s^2)*(1-s) + p[3]*s^3;Linear interpolation written in the same way is:FinalPosition = p[0]*(1-s)+p[1]*s;Mind you, if you are using bezier curves you will not pas through the middle two vertices and it will be trickier to implement, though visually one hell of a lot better.   [edited by - Drath on December 8, 2003 4:55:46 PM];  Have a look at Catmull-Rom splines, they''re the way to go for your needs.  Nescis mi fili, quantilla prudentis mundus regatur ;  Are they the ones that pass through each vertex?They use some matrix for it or something if I remember for I am sure I saw an article on them... ;  Here, have a look at this: (CAUTION: spoiler inside  )http://www.mvps.org/directx/articles/catmull/index.htm    Nescis mi fili, quantilla prudentis mundus regatur 