//call camera_path(""); to let the camera run along a path in the level
function camera_path(pathname)
{
// create a dummy path entity
me = ent_create(NULL,nullvector,NULL);
path_set(me,pathname);
var dist = 0;
var vLastPos[3];
var vDir[3];
while(1)
{
// place the camera on the path
path_spline(me,camera.x,dist);
dist += 5*time_step;
// let the camera look ahead
vec_diff(vDir,camera.x,vLastPos);
vec_to_angle(camera.pan,vDir);
vec_set(vLastPos,camera.x);
wait(1);
}
}