Hey everyone,

I've been experimenting with what I was hoping would be a simple camera toggle between 3rd person and 1st person point of view. The functionality seems to work. It switches between the 2 views, but after I switch the first time...my pan starts to look shaky and stutters. Any thoughts?

Here's the function:

Code:
function camera_follow(ENTITY* ent)
{	
	var camx = -150;
	var camy = 10;
	var camz = 50;
	var camtilt = -13;
	
//	var camx;
//	var camy;
//	var camz;
//	var camtilt;
		
	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);	
	}
}




"To one who has faith, no explanation is necessary. To one without faith, no explanation is possible." - St. Thomas Aquinas