that is a nice camera follow code. but is too rigid, you can add some nice dampening by filtering the camare angle a litle.
somethihg like this:
Code:

var prevPan = 0;
function SetCamera()
{
var tau;
camera.x = p_vehicle.x - 350 * cos(p_vehicle.pan);
camera.y = p_vehicle.y - 350 * sin(p_vehicle.pan);
camera.z = p_vehicle.z + 100;
//camera.pan = p_vehicle.pan;
// apply a low pass filter to the camera angles
// tau = 0.3; // play with this for different damping effects
prevPan = prevPan * (1 - tau) + p_vehicle.pan * tau;
camera.pan = prevPan;

// to do: apply fi;terring to this angle too
camera.tilt = -10;
}



this code will produce a nice lagging of the camara allowing you to see the relative movement of the vehicle chassis.

I hope it works because I did not tested.
(Please do not take it offesinvely, I just one to help you people )

Newton


Last edited by Newton; 02/25/04 02:38.