Superku, that's a good point about the "camera_Xstperson" loop never stopping. That would explain why my camera.tilt was not resetting...and why sometimes...it would just keep getting bigger and bigger as a variable.
And Malice, that's exactly what I needed, a cam STATE variable to "re-set" every time the function switched..
So, with both of your ideas/advice, now I've got this, and it works perfectly! Thanks guys!
var cam_mode; //global variable
function camera_1stperson()
{
camera.x = my.x + 11 * cos(my.pan);
camera.y = my.y + 11 * sin(my.pan);
camera.z = my.z + 25;
camera.pan = my.pan;
camera.tilt += (key_pgup-key_pgdn)*5*time_step;
if(key_home)
{camera.tilt = 0;}
camera.roll = 0;
}
function camera_3rdperson()
{
camera.x = my.x - 150 * cos(my.pan);
camera.y = my.y - 150 * sin(my.pan);
camera.z = my.z + 50;
camera.pan = my.pan;
camera.tilt = -15;
camera.roll = 0;
}
function camera_3rdperson2()
{
camera.x = my.x - 250 * cos(my.pan);
camera.y = my.y - 250 * sin(my.pan);
camera.z = my.z + 200;
camera.pan = my.pan;
camera.tilt = -25;
camera.roll = 0;
}
function select_cameras()
{
while(1)
{
if(key_7)
{
camera.tilt = 0;
cam_mode = 1;
}
if(key_8)
{cam_mode = 2;}
if(key_9)
{cam_mode = 3;}
if(cam_mode ==1)
{camera_1stperson();}
if(cam_mode ==2)
{camera_3rdperson();}
if(cam_mode ==3)
{camera_3rdperson2();}
wait(1);
}
}