function camera_follow(ENTITY* ent)
{
var camx;
var camy;
var camz;
var camtilt;
proc_mode = PROC_EARLY;
while(1)
{
if(key_9)
{
camx = -150;
camy = 10;
camz = 50;
camtilt = -13;
}
if(key_0)
{
camx = 5;
camy = 0;
camz = 5;
camtilt = 0;
}
vec_set(camera.x,vector(camx,camy,camz)); // camera position relative to the player
vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
vec_add(camera.x,ent.x); // add player position
vec_set(camera.pan,vector(ent.pan,camtilt,0)); // look in player direction, slighty down
wait(1);
}
}